Radio Buttons and Variables

Fredrik Lundh fredrik at pythonware.com
Fri Jul 16 15:51:10 EDT 1999


Gordon Williams <g_will at cyberus.ca> wrote:
> I'm having trouble getting radio buttons and variables working properly. 
> The code works properly the first time it is run from Pythonwin but the
> second time the variable does not update properly.  This means that
> foovar.get()=0 regardless of the radio button pressed.
> 
> Each time the script is run, print foovar indicates a new variable (eg
> PY_VAR0 then PY_VAR1 etc).  Could this be the problem?  

the fact that you're running this under PythonWin is
definitely the cause of the problem; the code looks
fine, and I cannot repeat this problem using my
favourite IDE...

> Any ideas to solve this?

try changing:

     foovar = IntVar()

to

     foovar = IntVar(root)

and see if that helps.

</F>





More information about the Python-list mailing list