WxWidget/WxPython; 3 列可调整大小的布局
我试图弄清楚如何拥有一个 3 列布局,其中(较小的)左列和右列可以通过中心/主区域每一侧的可拖动分隔符来调整大小。我尝试过使用 splitwindow 但似乎只分为两部分。
希望有人能给我指点如何做到这一点。
I'm trying to figure out how i can have a 3 column layout where the (smaller) left and right columns are resizable with a draggable separator on each side of the center/main area. I've tried using splitwindow but that seems to only split in two parts.
Hope someone can give me pointers on how it can be done.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议您并排创建三个面板。当用户调整其中一个面板的大小时,您必须调整其他面板的大小进行补偿 - 以便不存在间隙或重叠。您可以通过处理调整大小事件来完成此操作,可能是在三个面板的父窗口中。
另一种需要编写更少代码的方法是使用 wxGrid ,其中一行三列,列和行的宽度标签为零。您将失去面板的灵活性,但 wxGrid 会为您调整列宽的大小。
I susggest that you create three panels, side by side. When one of the panels is resized by the user, you will have to adjust the size of the other panels to compensate - so that there are no gaps or overlaps. You can do this by handling the resize event, probably in the parent windows of the three panels.
Another way, which requires you to write less code, would be to use wxGrid with one row and three columns and zero width labels for columns and rows. You will lose the flexibility of panels, but wxGrid will look after the resizing of the column widths for you.