On 03 Jul 2005 02:32:21 -0700, Paul Rubin <http://[EMAIL PROTECTED]> wrote:

> Python 2.4, Windows XP.  If I say:
>
>     f = Frame()
>     f.grid()
>     v = IntVar()
>     c = Checkbutton(f, text='hi there', variable=v)
>     c.grid()
>     f.mainloop()
>
> then the checkbutton should initially display as being checked.
> But it doesn't.  It shows up unchecked, even though v.get() returns 1.
> The select operation DOES update the display if there's no variable.

In tcl/tk, booleans are not integers. So using an IntVar to represent something 
which is basically a boolean will cause unexpected behaviors like the one 
you're experiencing here. Just do:

...
v = BooleanVar()
v.set(1)
...

and everything should be fine.

HTH
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in 
'U(17zX(%,5.zmz5(17;8(%,5.Z65\'*9--56l7+-'])"
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to