[Tkinter-discuss] Radiobutton

Douglas S. Blank dblank at brynmawr.edu
Sat Feb 11 02:04:04 CET 2006


Martin,

Your example works for me. I'm on Linux, Python 2.4.1, FC4.

I don't usually use globals; maybe you have another global somewhere
colliding with the one that you are using?

-Doug

On Sat, 2006-02-11 at 01:48 +0100, Martin Weisel wrote:
> from Tkinter import *
> root = Tk()
> 
> def radio1():
>         global tmp
>         tmp = IntVar()
>         Yes = Radiobutton(root, text = 'yes', value = 1 , variable =
> tmp)
>         Yes.pack(side = LEFT)
>         Yes.select()    #set Yes initially
>         No = Radiobutton(root, text = 'no', value = 2 , variable =
> tmp).pack(side =
> LEFT)
> 
> radio1()
> root.mainloop() 
-- 
Douglas S. Blank       Computer Science
Assistant Professor    Bryn Mawr College
(610)526-6501          http://cs.brynmawr.edu/~dblank




More information about the Tkinter-discuss mailing list