简体   繁体   English

等价于wxPython中的SWT的.pack()吗?

[英]Equivalent for SWT's .pack() in wxPython?

In wxPython, is there a short form of: 在wxPython中,是否存在以下简短形式:

size = object.GetBestSize()
object.SetSize(size)

(For controls or for frames and dialogs.) .Layout() only adjusts the sizes of the child controls. (对于控件或框架和对话框。). .Layout()仅调整子控件的大小。

In SWT there's .pack() for this. SWT中.pack()

Unless you set the size of the widget explicitly, they generally already adjust to the right size. 除非您明确设置小部件的大小,否则它们通常已经调整为正确的大小。 If you add widgets to a sizer and tell them to stretch, then that won't be the case, of course. 如果将窗口小部件添加到大小调整程序中并告诉它们进行拉伸,那么事实并非如此。 You can also use the sizer's Fit() method to force it too, although I rarely think this is necessary. 您也可以使用sizer的Fit()方法来强制执行此操作,尽管我很少认为这是必需的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM