user8312764
user8312764

Reputation:

Add text entry widget over picture in tkinter using python

How can I make a text entry widget over picture in tkinter using python?
The code I am using:

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()

It can make a button (OK) , why it can't make entry text widget?

Upvotes: 1

Views: 1731

Answers (1)

martin
martin

Reputation: 736

You forgot to pack the Entry field, just try something like:

E1 = Entry(root, bd = 5,show='*') 
E1.pack(side=BOTTOM, fill=BOTH, expand=YES)

And customize the position and behaviour as you prefer.

Upvotes: 3

Related Questions