Tkinter几何恢复正常 [英] Tkinter Geometry Return to Normal
问题描述
我有一个tkinter窗口,可以使用geometry(width+height)
和overrideredirect(True)
进行全屏显示,但是现在当我将窗口恢复为正常大小并执行命令overrideredirect(False)
时,我似乎无法获得该窗口会自动跟随其中的小部件的大小,因为如果不更改大小,它将自动执行.您知道什么方法可以让窗口再次自动遵循小部件的大小吗?预先谢谢您!
I have a tkinter window which I am able to make fullscreen, using geometry(width+height)
and overrideredirect(True)
, but now when I return the window back to a normal size and execute the command overrideredirect(False)
, I cannot seem to get the window to automatically follow the size of the widgets inside it, as it would do had I not changed the size. Do you know any way which I could return the window to automatically following the size of the widgets again? Thank You in Advance!
推荐答案
调用值""
的几何,以使其重置为自然尺寸.
Call the geometry with a value of ""
to get it to reset itself to its natural size.
Tkinter基于tk,并且 tk文档就此事说:
Tkinter is based on tk, and the tk docs say this on the matter:
如果将newGeometry指定为空字符串,则任何现有字符串 用户指定的窗口几何形状被取消,窗口将 还原为其窗口小部件内部要求的大小.
If newGeometry is specified as an empty string then any existing user-specified geometry for window is cancelled, and the window will revert to the size requested internally by its widgets.
这篇关于Tkinter几何恢复正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!