By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,730 Members | 1,153 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,730 IT Pros & Developers. It's quick & easy.

Tkinter scrollbar and checkbox

P: n/a

Hi,

I'm stumped on how to have a scrollbar with a long list of checkboxes.
Given code like:

from Tkinter import *
root = Tk()
states = []
for i in range(150):
var = IntVar()
chk = Checkbutton(root, text=str(i), variable=var)
chk.grid(sticky=W)
states.append(var)
root.mainloop()
print map((lambda var: var.get()), states)

I've tried adding this to a frame then adding the frame to a canvas
and it gets complicated rather quickly...

Is there a simple way to add a scroll bar?

Thanks
Jun 27 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Apr 24, 7:11*am, goldtech <goldt...@worldpost.comwrote:
Hi,

I'm stumped on how to have a scrollbar with a long list of checkboxes.
Given code like:

from Tkinter import *
root = Tk()
states = []
for i in range(150):
* * var = IntVar()
* * chk = Checkbutton(root, text=str(i), variable=var)
* * chk.grid(sticky=W)
* * states.append(var)
root.mainloop()
print map((lambda var: var.get()), states)

I've tried adding this to a frame then adding the frame to a canvas
and it gets complicated rather quickly...

Is there a simple way to add a scroll bar?

Thanks
I use wxPython most of the time, however effbot has a good tutorial on
scrollbars for Tkinter that I think you might find helpful:

http://effbot.org/zone/tkinter-scrollbar-patterns.htm

Here's another link on the subject:

http://www.pythonware.com/library/tk.../scrollbar.htm

HTH

Mike
Jun 27 '08 #2

P: n/a
snip...
>
I use wxPython most of the time, however effbot has a good tutorial on
scrollbars for Tkinter that I think you might find helpful:

http://effbot.org/zone/tkinter-scrollbar-patterns.htm

Here's another link on the subject:

http://www.pythonware.com/library/tk.../scrollbar.htm

HTH

Mike
Indeed, I see it:

http://effbot.org/zone/tkinter-autoscrollbar.htm

Many Thanks.

Lee
Jun 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.