如果可能,如何设置 Sizer 内单元格的背景颜色或 Sizer 的网格线?
我对 wxWidgets 很困惑,特别是 wxPython 中的 wx.Sizer。我已经阅读了这些文档,我面前有一份《wXPython in Action》,并且已经把问题放在一边,去研究其他事情,希望在我的头骨中孕育出一个更好的 sizers 心智模型。这些都没有奏效。
我并没有摸索,甚至没有达到可以有效地讨论尺寸确定器如何工作的地步。在 HTML 中,我至少可以在某些 div
或 td
上设置背景颜色,或者调用 border
以便我可以看到情况如何布置。在这里,我有一个灰色的区域,不知道它源自哪个嵌套静态框大小调整器。在把网格袋尺寸测量器搞得一团糟之后,我给了静态盒子尺寸测量器。
无论哪种选择至少都可以让我了解它们是如何工作的。
I am flailing about with wxWidgets, in particular, the wx.Sizer in wxPython. I have read the documents, I have a copy of wXPython in Action before me, and have set aside the problem to work on other things a better mental model of sizers hopefully gestated within my skull. None of this has worked.
I am not grokking, or even getting to the point where I can bang about usefully, how sizers work. In HTML, I could at least set a background color on some div
or td
, or call forth border
s so I could see how things are laid out. Here, I have a grey expanse and no idea which of the nested static box sizers from which it originates. I am giving static box sizers after making a mess out of the grid bag sizers.
Either alternative would let me at least get a handle on how these work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虽然不能解决您的问题,但了解 sizer 如何工作的一个好方法是安装 Code::Blocks并使用 wxSmith 插件来设计你的界面(我相信它与 Code::Blocks 捆绑在一起)。 Code::Blocks 适用于所有主要平台。
wxSmith 通过用红色边框突出显示您正在使用的 sizer 来为您提供实时视图。
作为一个额外的好处,wxSmith 非常适合为您生成 GUI 代码,而不是手动生成。
Although not an answer to your problem, a good way to get a handle on how sizers work is to install Code::Blocks and use the wxSmith plugin to design your interfaces (I believe it is bundled with Code::Blocks). Code::Blocks is available for all major platforms.
wxSmith gives you a real-time view of the sizers you are using by highlighting them with red borders.
As an extra benefit, wxSmith is great for generating GUI code for you instead of doing it by hand.