wxPython:如何将一个面板放在另一个面板上 [英] wxPython: how to lay one panel over another

查看:105
本文介绍了wxPython:如何将一个面板放在另一个面板上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是关于 wxPython.

This is about wxPython.

我想要 2 个面板,一个放在另一个上面:
PanelBG 应该是某种背景",有自己的 GridBagSizer 和子面板、StaticTexts 等;
PanelFG 应该是前景"面板,也有自己的 GridBagSizer 和一些静态文本、按钮......但是透明的背景,这样 PanelBG 在任何地方都是可见的PanelFG 不放置小部件.

I would like to have 2 Panels laying one over the other:
PanelBG should be some sort of a "background", with its own GridBagSizer with subPanels, StaticTexts and so on;
PanelFG should be the "foreground" panel, also with its own GridBagSizer with some StaticTexts, Buttons... but a transparent background, in such a way that PanelBG is visible wherever PanelFG doesn't lay widgets.

我需要两个面板都拉伸到框架的所有边,即使在调整窗口大小时,虽然从不改变相互比例,这就是为什么我不确定是否有使用绝对定位的方法.

I need both Panels to stretch to all the sides of the frame, even when resizing the window, though never changing the reciprocal proportions, that's why I'm not sure if there's a way to use absolute positioning.

如果您想知道,我不想使用单个面板的原因是合并 2 个 GridBoxSizer 需要我在 sizer 中放置更多的单元格,因为前景和背景的行和列不不总是一致的,我应该将它们分成许多单元格,网格尺寸增长到数百**2.
由于我想放在前台的内容需要经常更新和刷新,因此每次都需要重新绘制所有单元格,这需要 10 - 20 秒才能完成操作(已测试).只更新前台只需要百分之一秒.

In case you are wondering, the reason why I don't want to use a single Panel is that merging the 2 GridBoxSizers would require me to place many many more cells in the sizer, because rows and columns of foreground and background don't always coincide, and I should split them in many cells, with grid dimensions growing up to hundreds**2.
Since the content I want to put in the foreground needs to be updated and refreshed quite often, this would require redrawing all the cells every time, which would take 10 - 20 seconds to complete the operation (tested). Updating only the foreground would require just some hundredths of a second instead.

谢谢!

推荐答案

这至少是部分方向的改变,但可能值得研究一下您拥有的其他渲染选项.

This would be at least partially a change of direction, but it might be worth examining what other rendering options you have.

特别是,我在考虑 wxWebKit (http://wxwebkit.kosoftworks.com/),它可以让您使用 WebKit 浏览器渲染引擎进行分层等.我不确定它是否处于可以提供您需要的一切的阶段,因为我还没有真正使用过它,但即使它不起作用,它也可能是一种值得尝试的方法 - 将 HTML/CSS 用于您的一部分显示,同时将整体包装在 wxPython 应用程序中.

In particular, I'm thinking of wxWebKit (http://wxwebkit.kosoftworks.com/), which would let you do layering, etc. using the WebKit browser rendering engine. I'm not sure whether it's at a stage that would provide everything you need since I haven't actually used it, but even if it doesn't work then it may be an approach worth trying - using HTML/CSS for part of your display, while wrapping the whole in a wxPython app.

这篇关于wxPython:如何将一个面板放在另一个面板上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆