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

20th Sep 2018, 11:07 AM
NoxFly
NoxFly - avatar
13 Respuestas
+ 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. :)
20th Sep 2018, 9:03 PM
Ferhat Sevim
Ferhat Sevim - avatar
+ 6
input1.place(anchor='center', rely=.4, relx=.5) input2.place(anchor='center', relx=.5, rely=.6)
20th Sep 2018, 6:47 PM
Mert Yazıcı
Mert Yazıcı - avatar
+ 4
Enzo Falcon I didnt mean center the text, but center the Entry, and with the Y axis
20th Sep 2018, 12:57 PM
NoxFly
NoxFly - avatar
+ 4
Mert Yazıcı look like it doesnt work 🤔
20th Sep 2018, 4:34 PM
NoxFly
NoxFly - avatar
+ 4
NoxFly ドリアン did you use grid anywhere
20th Sep 2018, 4:59 PM
Mert Yazıcı
Mert Yazıcı - avatar
+ 4
I dont think
20th Sep 2018, 5:29 PM
NoxFly
NoxFly - avatar
+ 4
how to use them ?
20th Sep 2018, 5:30 PM
NoxFly
NoxFly - avatar
+ 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
20th Sep 2018, 5:49 PM
Ferhat Sevim
Ferhat Sevim - avatar
+ 4
Wow thanks, I've understood, and I'll try it soon !
20th Sep 2018, 9:11 PM
NoxFly
NoxFly - avatar
+ 3
entry.pack(anchor='center')
20th Sep 2018, 3:25 PM
Mert Yazıcı
Mert Yazıcı - avatar
20th Sep 2018, 6:33 PM
NoxFly
NoxFly - avatar
+ 3
doesnt work too :(
20th Sep 2018, 7:11 PM
NoxFly
NoxFly - avatar