from tkinter import*defmsgShow():
label.config(text="今天是个好日子",bg="lightyellow",fg="blue")
root=Tk()
root.title("button的test2")
root.geometry("300x200")
label=Label(root)
pic=PhotoImage(file="图标.png")#compound=TOP显示图片在上面 CENTER显示图片和文字重叠#可以用 LEFT TOP RIGHT BOTTOM CENTER#可以用cursor="star"实现按钮上鼠标显示为星星
btn=Button(root,image=pic,compound=LEFT,text="点我看看吧",command=msgShow,cursor="star")
label.pack()
btn.pack()
root.mainloop()