[Tutor] Checkbox problem in Tkinter

ANKUR AGGARWAL coolankur2006 at gmail.com
Mon Jan 10 05:44:22 CET 2011


Hey I write this code up

from Tkinter import *
root=Tk()
var=StringVar()
c=Checkbutton(root,text="hello",variable=var,onvalue="hhhh",offvalue="gggg")
c.pack()
root.mainloop()

and i got the output as -
[image: Screenshot.png]

When i take the var as of string variable type i am  unable to edit the
checkbox. It comes slected predefined and the widget in kindof Invisible and
u can say uneditable. Can anybody tell me whats i am  doing wrong in this???
Its works fine if i take the var variable as the integer variable. I can
deselect and select in that case and it gives me the desired result but in
string case i am unable to do so as checkbox is invisible type.
I am using Python 2.6
Thanks In Advance
Ankur Aggarwal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110110/9703010d/attachment-0001.html>


More information about the Tutor mailing list