Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I send a string in a function

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 :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading