python - Tkinter .grid() position in center of screen -


in tkinter, i'm using grid() place widgets , want position widget, namely label, in middle of screen. know how this?

for example, following code: widget.grid(row=0, column=1) want column 1 there 3 columns (0, 1, 2) without having place widget in column 2.

thanks.

to able achieve this, need know how many rows , columns window have.

for example if have 3 rows , 3 columns (the minimum able locate in center), screen split this:

-------------------------------------------- |              |             |             | |      0,0     |     0,1     |     0,2     | |              |             |             | |              |             |             | -------------------------------------------- |              |             |             | |      1,0     |     1,1     |     1,2     | |              |             |             | |              |             |             | -------------------------------------------- |              |             |             | |      3,0     |     3,1     |     2,2     | |              |             |             | |              |             |             | -------------------------------------------- 

with cells labelled row, column.

so if have setup want set label row 1 , column 1.

hope helps!


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -