Home > OS >  How can I send a string in a function
How can I send a string in a function

Time:05-21

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)

CodePudding user response:

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)

  • Related