What is 'tk::placeWindow' and how can it center the window on my screen?

Im trying to find a way to center the window of a simple counter I made using Tkinter. Trying to find another way than using geometry I came across:

window.eval('tk::placeWindow . center')

But I don’t know why this works and also I cant find it in the documentation. Anyone knows the answer?

>Solution :

The code below executes code that is written in tcl and calls a tcl procedure. There are quite a few of them, but they mostly used for internal procedures and rarely useful.

window.eval('tk::placeWindow . center')

The placeWindow procedure can be found here and does nothing that you couldn’t do with python. They are most likely for maintainers that are used to tcl.

Leave a Reply