471,072 Members | 987 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,072 software developers and data experts.

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 8536
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 leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.