Python

Moderators: None (Apply to moderate this forum)
Number of threads: 474
Number of posts: 1166

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Scroll bars with tkinter Posted by St. Jimmy on 6 Mar 2005 at 10:51 PM
Hello,
I have a GUI that I made up and inside it is a listbox, I got the scroll bar linked to the listbox. The problem I'm having is that the scroll bar is not stretched to the size of the list box. I can't seem a find a solution to this since I am not using pack() or making my GUI with classes since I am fairly new to this. Any one have any advice to getting the scroll bar to fit the list box?

Thank you for any advice that you guys can give.
Report
Re: Scroll bars with tkinter Posted by Drost on 15 Mar 2005 at 2:08 AM
: Hello,
: I have a GUI that I made up and inside it is a listbox, I got the scroll bar linked to the listbox. The problem I'm having is that the scroll bar is not stretched to the size of the list box. I can't seem a find a solution to this since I am not using pack() or making my GUI with classes since I am fairly new to this. Any one have any advice to getting the scroll bar to fit the list box?
:
: Thank you for any advice that you guys can give.

Hi, how about:

from Tkinter import *

root = Tk()

scrollbar = Scrollbar(root)
scrollbar.grid(column=1, row=0, sticky='NS')

listbox = Listbox(root, yscrollcommand=scrollbar.set)
for i in range(1000):
  listbox.insert(END, str(i))
listbox.grid(column=0, row=0)

scrollbar.config(command=listbox.yview)

mainloop()


Codesnippet taken from (with slight changes):
http://www.pythonware.com/library/tkinter/introduction/index.htm


That blue part makes the widget (using the grid geometry manager) to take up the remaining space in the directions given (N=north, S=south, E=east, W=west).

I don't know whether that was the problem or...

Drost



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.