如何在函数中发送字符串

How can I send a string in a function

我有这段代码,我想让它在执行命令时发送“b1” mic_press b1 = Button(root, image= img1, bd=0, bg='#292424', activebackground='#292424', command=mic_press)

我猜你想要

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

Tkinter 命令不接收和传递任何参数,但您可以使用 lambda 函数以所需的值调用您的方法