from PIL import Image, ImageTk
import tkinter as tk
window = tk.Tk()
window.title("我是。。")
window.geometry('1000x1000')
global img_png
var = tk.StringVar()
def Open_Img():
global img_png
var.set('已打开')
Img = Image.open('my_png.png')
img_png = ImageTk.PhotoImage(Img)
def Show_Img():
global img_png
var.set('已显示')
label_Img = tk.Label(window, image=img_png)
label_Img.pack()
Label_Show = tk.Label(window,
textvariable=var,
bg='gray', font=('Arial', 12), width=15, height=2)
Label_Show.pack()
btn_Open = tk.Button(window,
text='路径:C:\\my_img',
width=130, height=2,
command=Open_Img)
t = tk.Text(window)
btn_Open.place(x=50,y=50)
btn_Show = tk.Button(window,
text='精度:99.7%',
width=130, height=2,
command=Show_Img)
btn_Show.place(x=50,y=100)
window.mainloop()
转载请注明原文地址:https://ipadbbs.8miu.com/read-9408.html