Home > Software design >  Python: Tkinter: moving objects from the centre of it with place()
Python: Tkinter: moving objects from the centre of it with place()

Time:06-20

I just want to find out how I can move an object/text/... in a window not from the top left corner, but from the centre of itself.

Thanks for helping PS: English is not my mother language, so I hope my question is understandable.

CodePudding user response:

Try place with relx, rely as a fraction of the height and width of the parent widget.

Example:

my_label = tk.Label(root, text="Hello World!")
my_label.place(relx=.5, rely=.5, anchor='center')
  • Related