wxPython 向导的大小调整
Sizing of wxPython Wizard
我正在使用 wxPython 创建一个包含多个页面的向导对话框。我在布置控件时遇到问题,因为每个页面的大小至少与最大的向导页面一样大。例如。如果我的向导有三页,而第三页比其他两页多 controls/widgets,则第二页和第三页有很多额外的 space,因为向导根据第 3 页计算其大小(因为它是最大的。)第一页和第二页看起来真的很草率。
我在向导 class 的文档中看到了这一点,这让我相信不可能为每个向导页面设置自定义页面大小:
The wizard is laid out using sizers and the page area sizer is the
place-holder for the pages. All pages are resized before being shown
to match the wizard page area.
Page area sizer has a minimal size that is the maximum of several
values. First, all pages (or other objects) added to the sizer.
Second, all pages reachable by repeatedly applying WizardPage.GetNext
to any page inserted into the sizer.
Third, the minimal size specified using SetPageSize and FitToPage .
Fourth, the total wizard height may be increased to accommodate the
bitmap height. Fifth and finally, wizards are never smaller than some
built-in minimal size to avoid wizards that are too small.
The caller can use Sizer.SetMinSize to enlarge it beyond the minimal
size. If RESIZE_BORDER was passed to constructor, user can resize
wizard and consequently the page area (but not make it smaller than
the minimal size).
It is recommended to add the first page to the page area sizer. For
simple wizards, this will enlarge the wizard to fit the biggest page.
For non-linear wizards, the first page of every separate chain should
be added. Caller-specified size can be accomplished using
Sizer.SetMinSize . Adding pages to the page area sizer affects the
default border width around page area that can be altered with
SetBorder .
是否有人有解决方案或变通方法可以让我的向导页面仅根据当前页面上的内容调整大小?
我觉得这听起来很正确。该文档确实似乎确实表明您无法使用向导小部件执行您想要执行的操作。不过,您可以推出自己的向导。只需创建一系列面板并隐藏后面的页面,或者在您完成向导时创建后续页面。
我写了一个关于滚动您自己的向导的教程,欢迎您将其用作起点:
当然,让向导在您浏览时改变其大小会分散注意力,这不是正常的向导行为。您可能需要重新考虑如何布置控件或将大页面上的小部件放入滚动面板小部件中,使其与其他两个小部件的大小相同。
我正在使用 wxPython 创建一个包含多个页面的向导对话框。我在布置控件时遇到问题,因为每个页面的大小至少与最大的向导页面一样大。例如。如果我的向导有三页,而第三页比其他两页多 controls/widgets,则第二页和第三页有很多额外的 space,因为向导根据第 3 页计算其大小(因为它是最大的。)第一页和第二页看起来真的很草率。
我在向导 class 的文档中看到了这一点,这让我相信不可能为每个向导页面设置自定义页面大小:
The wizard is laid out using sizers and the page area sizer is the place-holder for the pages. All pages are resized before being shown to match the wizard page area.
Page area sizer has a minimal size that is the maximum of several values. First, all pages (or other objects) added to the sizer. Second, all pages reachable by repeatedly applying WizardPage.GetNext to any page inserted into the sizer.
Third, the minimal size specified using SetPageSize and FitToPage . Fourth, the total wizard height may be increased to accommodate the bitmap height. Fifth and finally, wizards are never smaller than some built-in minimal size to avoid wizards that are too small.
The caller can use Sizer.SetMinSize to enlarge it beyond the minimal size. If RESIZE_BORDER was passed to constructor, user can resize wizard and consequently the page area (but not make it smaller than the minimal size).
It is recommended to add the first page to the page area sizer. For simple wizards, this will enlarge the wizard to fit the biggest page.
For non-linear wizards, the first page of every separate chain should be added. Caller-specified size can be accomplished using Sizer.SetMinSize . Adding pages to the page area sizer affects the default border width around page area that can be altered with SetBorder .
是否有人有解决方案或变通方法可以让我的向导页面仅根据当前页面上的内容调整大小?
我觉得这听起来很正确。该文档确实似乎确实表明您无法使用向导小部件执行您想要执行的操作。不过,您可以推出自己的向导。只需创建一系列面板并隐藏后面的页面,或者在您完成向导时创建后续页面。
我写了一个关于滚动您自己的向导的教程,欢迎您将其用作起点:
当然,让向导在您浏览时改变其大小会分散注意力,这不是正常的向导行为。您可能需要重新考虑如何布置控件或将大页面上的小部件放入滚动面板小部件中,使其与其他两个小部件的大小相同。