Problem with variables and Tkinter...

Eric Brunel eric.brunel at pragmadev.N0SP4M.com
Tue Oct 14 08:20:08 EDT 2003


Baltor wrote:
> OK, so I'v got 11 radio buttons hooked up to one variable:
> self.weaponbonus. However, no matter what radio button I have checked,
> self.weaponbonus is treated as 0. This is my code:
> 
> 
> 
> 
> 
>         self.weaponbonus = IntVar

Try: self.weaponbonus = IntVar()

You need the parentheses to instantiate the class, or the variable will just 
point to the class itself:

 >>> v = IntVar
 >>> repr(v)
'<class Tkinter.IntVar at 0x8266634>'
 >>> v = IntVar()
 >>> repr(v)
'<Tkinter.IntVar instance at 0x82a2bec>'

HTH
-- 
- Eric Brunel <eric dot brunel at pragmadev dot com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com





More information about the Python-list mailing list