【发布时间】:2020-09-22 02:20:26
【问题描述】:
如何将标签中的文本发送到输入框,或者直接将图像的路径发送到tkinter中的输入框?
from tkinter import *
from PIL import ImageTk,Image
from tkinter import filedialog
root = Tk()
def open():
root.filename = filedialog.askopenfilename(initialdir="/", title="Select A File",filetypes=(("jpg files", "*.jpg"), ("all files", "*.*")))
my_label = Label(root, text=root.filename).pack()
my_btn = Button(root, text="Open files", command=open).pack()
#entry box
txt2 = Entry(root)
txt2.place(x=10, y=45)
root.mainloop()
【问题讨论】:
-
我不明白,你是在调用按钮中的函数来再次调用相同的函数?