Hello. I am trying to make a little gui. It has a button and a checkbox. If I push the button, it is supposed to print the value of the checkbox. But, I can not seem to get it right. How should I define the variable? Where should I put it? I have tried every way possible, and gotten lots of different errormessages.
Thanks in advance Øyvind from Tkinter import * import Tix, sys def vp_start_gui(): global w global root root = Tix.Tk() root.title('New_Toplevel_1') root.geometry('200x205+1157+142') w = New_Toplevel_1 (root) init() root.mainloop() def message(): print New_Toplevel_1.v.get() # print self.v.get() This doesn't seem to work either class New_Toplevel_1: def __init__(self, master=None): pass self.but26 = Button (master) self.but26.place(in_=master,x=60,y=30) self.but26.configure(command=message) self.but26.configure(text="button") self.che27 = Checkbutton (master) self.che27.place(in_=master,x=50,y=120) self.che27.configure(text="check") v = IntVar() self.che27.configure(variable=v) if __name__ == '__main__': vp_start_gui() -- This email has been scanned for viruses & spam by Decna as - www.decna.no Denne e-posten er sjekket for virus & spam av Decna as - www.decna.no _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor