from tkinter import *
from tkinter import messagebox
# 创建窗口
root = Tk()
btn01 = Button(root)
btn01["text"] = "点我就送花"
btn01.pack()
def songhua(e): # e就是事件对象
messagebox.showinfo("Message","送你一朵玫瑰花~~~")
print("送你99朵玫瑰花~")
btn01.bind("" ,songhua) # 表示点击鼠标左键时触发songhua函数
root.mainloop() # 调用组件的mainloop()方法,进入事件循环