Repost: Tkinter Checkbox Question
Jeff Epler
jepler at unpythonic.net
Sat Nov 23 21:32:32 EST 2002
On Sat, Nov 23, 2002 at 06:18:27PM -0800, Josiah wrote:
> What am I doing wrong in this sample? When I press the "status"
> button, the printout shows that "self.var.get()" returns a "0" weather
> the box is checked or not! Is this a Bug in Tkinter? Help please.
> Thanks!
> josiah
It looks fine to me.
If you have created more than one Tk(), then the IntVar may be in a
different interpreter than the checkbutton (for instance, by adding the
following two lines above 'root = Tk()'
not_root = Tk()
not_root.wm_withdraw()
I can get the behavior your describe)
You can make sure your variable is in the right interpreter by using
< self.var = IntVar(master)
just as you do for widgets. That change makes your script work whether or
not 'non_root' was created at startup.
Jeff
More information about the Python-list
mailing list