+ 2
Working in module Tkinter
I have a 3 buttons and 1 function. How to add string from field 'text' of button to argument of function? Example: from tkinter import * def my_f(text_button): my_label.set("{} button".format(text_button)) b1 = Button(root, text="First", command=my_f) b2 = Button(root, text="Second", command=my_f) b3 = Button(root, text="Third", command=my_f) ...
1 Réponse
+ 2
I find solution:
b1 = Button(root, text="First", command=lambda i="First": my_f(i))
Thanks