If i run this Python code:
from Tkinter import *; w = Tk(); w.geometry( "640x480" ); print( w.geometry() )
i will get "1x1+0+0" output. But if i start interpreter and execute this as two separate commands, i will get completely different output:
>>> from Tkinter import *; w = Tk(); w.geometry( "640x480" )
''
>>> w.geometry()
'640x480+101+73'
It seems geometry is not applied instantly, something else is needed : (. Maybe anyone knows what i need to do in order to update geometry inplace? I need it to correctly center/position main and child windows.
Calling update_idletasks()
on a window (or a widget) will force its geometry to update.
Here's a little text snippet from the Tkinter reference:
The geometry is not accurate until the application has updated its idle tasks. In particular, all geometries are initially "1x1+0+0" until the widgets and the geometry manager have negotiated their positions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With