【发布时间】:2017-07-17 11:14:55
【问题描述】:
如何在 tkinter 中使用 python 在图片上创建文本输入小部件?
我正在使用的代码:
from tkinter import *
from PIL import ImageTk, Image
import os
root = Tk()
root.title('Title')
E1 = Entry(root, bd = 5,show='*') # tried this line of code but it didn't worked
img = ImageTk.PhotoImage(Image.open("path/to/image.png"))
panel = Label(root, image = img)
panel.pack(side = "bottom", fill = "both", expand = "yes")
c = Button(text=" OK ")
c.place(relx=0.95, rely=0.98, anchor=SE)
root.mainloop()
可以做一个按钮(OK),为什么不能做entry text widget?
【问题讨论】:
-
你不是
packing你的条目。 -
另外,不要混合几何管理器。(打包、放置等)选择一个并坚持下去。
-
@Lafexlos 真的谢谢你,我错过了那条线。
-
@Lafexlos 你知道如何更改文本输入小部件的位置吗?