我想创建一个函数,它将从按钮单击中获取参数。例如:
from Tkinter import *
def func(b):
number = 2*b
print number
return
root=Tk()
# By clicking this button I want to set b = 1 and call func
b1 = Button(root,...)
b1.pack()
# By clicking this button I want to set b = 2 and call func
b2 = Button(root,...)
b2.pack()
root.mainloop()
所以点击 b1 后,“number”应该是 2,点击 b2 后,“number”应该是 4。
我希望我能很好地解释我的问题。
感谢您的回答
末日挂载