简单的 wxPython 框架内容大小调整 - 比率?
我有一个 wxPython 应用程序,带有一个框架和一个面板。该面板上有许多静态框,每个静态框都有按钮和文本框。
我刚刚开始阅读有关尺寸测量器的信息,但它们似乎可能超出了我的需要,或者它们可能正是我所需要的,但我不知道如何正确使用它们!
该框架当前以 1920 x 1080 的分辨率打开。如果用户拖动右下角来调整应用程序的大小,我只是希望所有内容根据需要变得更小或更大,以保持相同的尺寸比例。
这可能吗?
谢谢你!
编辑:附加信息:我使用 wxPython 2.8 和 Boa 来构建 GUI。我正在考虑尝试另一个指南。
因此,在阅读了更多有关 sizer 的信息后,我正在考虑执行以下操作: 添加一个 gridsizer 并将窗口的元素基本上划分为行和列,然后根据需要设置每行和列的大小,直到实现原始布局。然后我想设置行和列以正确调整大小?这是个好主意吗?
I have a wxPython app with one frame and one panel. On that panel are a number of static boxes, each of which has buttons and textboxes.
I have just begun reading about sizers, but they seem like they might be more than what I need, or it could that they are exactly what I need but I don't know how to use them correctly!
The frame currently opens at 1920 x 1080. If the user drags the bottom right corner to resize the app, I just want everything to get smaller or larger as needed to keep the same size ratio.
Is this possible?
Thank you!
edit: additional info: I used wxPython 2.8 and Boa to construct the GUI. I am contemplating trying another gui ide.
So after reading some more about sizers, I am thinking about doing the following:
add a gridsizer and basically divide my window's elements into rows and columns, then set each row and column's size as necessary until I achieve the original layout. Then I guess set the rows and columns to resize correctly? Is this a decent idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于复杂的布局,我会在一张纸上画出草图。然后,我以不同的方式在小部件周围绘制方框,以决定使用哪些大小调整器。您几乎可以将任何尺寸测定器嵌套在另一个尺寸测定器中。如果控件自然适合网格,那么使用某种网格大小调整器可能就可以了。如果没有,则使用 BoxSizer。我最常使用这些。
For complex layouts, I sketch it out on a piece of paper. Then I draw boxes around the widgets in different ways to decide what sizers to use. You can nest pretty much any sizer inside another one. If the controls naturally fit in a grid, then using a grid sizer of some sort is probably alright. If not, then use BoxSizers. I tend to use those the most.