import tkinter as tk def on_button_click(event): print("Button clicked!") root = tk.Tk() button = tk.Button(root, text="Click me") button.bind("<Button-1>", on_button_click) #绑定鼠标左键点击事件 button.pack() root.mainloop() ``` 这里,`bind`用于将`on_button_click`函数与按钮...