A Simple Tkinter Control Program--Slight Problem

W. eWatson notvalid2 at sbcglobal.net
Fri Mar 6 22:00:56 CET 2009


I like to see closure on a thread. This should do it.

from Tkinter import *
# Use of control variables and callbacks

def mycallback():
     print "User entered:" , e.get()
     print "Operation by 2 gives: ", e.get()*2, "and", v.get()*2

master = Tk()

#v=StringVar()
v=IntVar()
print v,type(v)
print v, type(v), type(v.get())
e = Entry(master,textvariable=v)
e.pack()
b = Button(master, text="Push to Print", width=10, command=mycallback)
b.pack()
e.focus_set()

v.set(123)

mainloop()


-- 
                                W. eWatson

              (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
               Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

                     Web Page: <www.speckledwithstars.net/>




More information about the Python-list mailing list