Tkinter Problem with Radiobuttons

Ryan Vartanian vartan at leland.stanford.edu
Tue Jul 18 19:16:42 EDT 2000


I am trying to use radiobuttons to select a value for a program, and I
am haveing trouble with the IntVar() and StringVar() classes.

My code looks like this:

self.selection=IntVar()
self.nativeButton=Radiobutton(self.byteWindow, text="Native: CFD
Datasets produced on this OS", variable=self.selection, value=0)

self.bigEButton=Radiobutton(self.byteWindow, text="Big Endian: Solaris,
SGI, Motorola", variable=self.selection, value=1)

self.littleEButton=Radiobutton(self.byteWindow, text="Little Endian:
Intel, DEC", variable=self.selection, value=2)
        
self.okButton=Button(self.byteWindow, text="Ok", command=self.Ok)
self.cancelButton=Button(self.byteWindow, text="Cancel",
command=self.Cancel)

All of this is packed in window, and things when I select a given
radiobutton, the value of the variable is not 0, 1, or 2, but PY_VAR0,
PY_VAR1, or PY_VAR2.  The documentation for IntVar() is sparse at best. 
Any suggestions on what is going on here?

Ryan Vartanian



More information about the Python-list mailing list