468,510 Members | 1,695 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,510 developers. It's quick & easy.

Tkinter scrollbar and checkbox


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
2 7804
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
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.

Similar topics

1 post views Thread by Thomas Buschhardt | last post: by
4 posts views Thread by Patrick L. Nolan | last post: by
1 post views Thread by syed_saqib_ali | last post: by
reply views Thread by syed_saqib_ali | last post: by
8 posts views Thread by Dustan | last post: by
1 post views Thread by C D Wood | last post: by
6 posts views Thread by Adam | last post: by
reply views Thread by NPC403 | last post: by
3 posts views Thread by gieforce | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.