Repost: Tkinter Checkbox Question

Josiah josiah7 at hotmail.com
Sat Nov 23 21:18:27 EST 2002


What am I doing wrong in this sample? When I press the "status"
button, the printout shows that "self.var.get()" returns a "0" weather
the box is checked or not! Is this a Bug in Tkinter? Help please.
Thanks!
josiah


#######################################################################
from Tkinter import *
root = Tk()

class App:

    def __init__(self, master):  

        frame = Frame(master) 
        frame.grid()
              
        self.var = IntVar() 
        self.CButton = Checkbutton(frame,text="check",variable=self.var)
        self.CButton.grid()

        self.buttonGo = Button(frame, text= "status", command=self.go)
        self.buttonGo.grid()

    def go(self):
        print self.var.get() 

app = App(root)
root.mainloop()
#######################################################################



More information about the Python-list mailing list