On Thu, Oct 8, 2009 at 6:04 PM, bob smith <[email protected]> wrote:
> Hi.  I’m using Tkinter to create a new Radiobutton in Python 3.  However,
> when I create the button, it starts off looking selected instead of
> unselected (though it behaves correctly like an unselected Radiobutton).  So
> this means when I create a group of Radiobuttons they all look selected when
> my program begins.

You have to associate the Radiobuttons with a variable, for example:

from tkinter import *

root = Tk()
root.grid()
v = IntVar()
button = Radiobutton(root, text = "Test RadioButton", variable=v, value=1)
button.grid(row = 0, column = 0, sticky = W)

button = Radiobutton(root, text = "Test RadioButton2", variable=v, value=2)
button.grid(row = 1, column = 0, sticky = W)

root.mainloop()


Kent
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to