tk.Button

https://pythonguides.com/python-tkinter-save-text-to-file/

from tkinter import *
from tkinter.ttk import *
ws = Tk()
ws.title("Python Guides")
ws.geometry("500x300")
filepath=f"D:\linbo.yang\study\python\idle\idle-master\Icons\python.gif"
image = PhotoImage(file=filepath)

ws.iconphoto(False, image)

button = Button(ws, text='Click Me !',image=image,compound=RIGHT)
button.pack(side=TOP)
ws.mainloop()

  

原文地址:https://www.cnblogs.com/linbo3168/p/15568066.html