[Tkinter-discuss] Checkbutton variable type

Bob Greschke bob at passcal.nmt.edu
Tue Aug 28 21:30:02 CEST 2007


The Checkbutton widget

Var = IntVar()
Checkbutton(Frm, text = "Destroy", variable = Var)

wants Var to be an IntVar, but it also works if Var is a StringVar  
and you set() Var to "0" and "1".  Is there a possibility that this  
will be "fixed" some time in the future, or would it be safe to keep  
Var as a StringVar, or is it not even really broken (I don't know Tcl/ 
Tk which I assume is allowing this?)?  In my case it would be nice to  
keep "0" or "1" in a MySQL database column and have a Tkinter form  
with a Checkbutton do the right thing without having to change the  
column to an int, or keep converting back and forth between chars and  
ints for that one column to keep from running into trouble in the  
future.

Thanks!

Bob



More information about the Tkinter-discuss mailing list