+ 6
PYTHON 3 | Modify coordinate
How can I modify coordinate of an input ? I want to align the Entry() to the middle Y of the window (Entry - tkinter)
13 Respostas
+ 3
from tkinter import *
f1 = Tk()
f1.title("name of prog")
f1.geometry("800x480")
f1.resizable(width=False, height=False)
f1.configure()
frame = Frame(f1)
frame.pack(fill=BOTH, expand=True)
input1 = Entry(frame, fg="#DDD", bg="#111", bd="8", justify="center", width=20, insertbackground="white")
input1.insert(END, "something")
input1.grid(row=2, column=1)
input2 = Entry(frame, fg="#DDD", bg="#111", bd="8", justify="center", width=20, insertbackground="white")
input2.insert(END, "something else")
input2.grid(row=0, column=1)
input3 = Entry(frame)
input3.insert(END, "Input 3")
#input3.grid(row=1, column=2)
input3.place(x=100, y=200)
f1.mainloop()
# I have added a frame and only used pack for frame. Then you don't need to pack each Entry and changed component f1 to frame in Entry
# I use both way grid and place.
# I hope I have understood you right. :)
+ 6
input1.place(anchor='center', rely=.4, relx=.5)
input2.place(anchor='center', relx=.5, rely=.6)
+ 4
Enzo Falcon I didnt mean center the text, but center the Entry, and with the Y axis
+ 4
Mert Yazıcı look like it doesnt work đ€
+ 4
NoxFly ăăȘăąăł did you use grid anywhere
+ 4
I dont think
+ 4
how to use them ?
+ 4
You can try Entry().place(x=10, y=40) and it will be easy for us if we can see the codes.
Edit: Entry doesn't have anchor option
+ 4
Wow thanks, I've understood, and I'll try it soon !
+ 3
entry.pack(anchor='center')
+ 3
doesnt work too :(
+ 2
I think this is your solution https://stackoverflow.com/questions/14386113/JUMP_LINK__&&__python__&&__JUMP_LINK-ttk-entry-how-to-center-the-input