TKinter Button widget

J.Jacob joost_jacob at hotmail.com
Sat Apr 20 13:22:53 EDT 2002


Here is your code modified so it works.
As you can see 'lambda' is used.  Read more about it in the manuals
and books, have fun learning things about Tkinter, i did like it.

#!/usr/bin/python

from Tkinter import *

def printNumber(number):
	print number
	
win = Tk()
Button(win, text='print 3', command=lambda: printNumber(3)).pack()
Button(win, text='print 5', command=lambda: printNumber(5)).pack()
win.mainloop()



More information about the Python-list mailing list