How can I send a string in a function

Advertisements

I have this code and I want to make it send "b1" when when executing the command mic_press b1 = Button(root, image= img1, bd=0, bg='#292424', activebackground='#292424', command=mic_press)

>Solution :

I guess you want

b1 = Button(root, image= img1, bd=0, bg='#292424', activebackground='#292424', command=lambda:mic_press('b1'))

Tkinter commands take and pass no arguments, but you can use a lambda function to call your method with the desired value(s)

Leave a ReplyCancel reply