0
点赞
收藏
分享

微信扫一扫

python GUI tkinter图片按钮功能

天悦哥 2022-02-22 阅读 49
import tkinter as tk
def msgShow():
label.config(text="hehehe", bg="lightyellow", fg="blue")
root = tk.Tk()
root.title('图片按钮')
imgBtn = tk.PhotoImage(file=r"C:\pic\pdf.png")
tk.Button(root, image=imgBtn, command=msgShow).pack()
label = tk.Label(root)
label.pack()
tk.mainloop()
举报

相关推荐

0 条评论