wxPython:静态框中的多行文本
通过这些东西学习我的方法并需要一些帮助。我试图拥有一个带有标签和内部多行文本框的 wxStaticBox (几乎就像应用程序将打印到的日志......)
这是我所能得到的:
self.sb_FoldersToScan = wx.StaticBox(panel, label="Folders to Scan:", size=(200,100))
boxSizer = wx.StaticBoxSizer(self.sb_FoldersToScan, wx.VERTICAL)
boxSizer.Add(self.sb_FoldersToScan, flag=wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT)
multiText = wx.TextCtrl(panel, -1,"test",size=(200, 100), style=wx.TE_MULTILINE)
multiText.SetInsertionPoint(0)
boxSizer.Add(multiText)
sizer.Add(boxSizer, pos=(1, 0), span=(1, 6), flag=wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT)
我已经拼凑了大部分内容都来自互联网——除了修复布局之外,现在不尝试做任何事情...
多文本框直接显示在 StaticBox 下方而不是在其内部?我是否使用了错误的控件?
Learning my way through this stuff and could use some help. I'm trying to have a wxStaticBox with a label and a multiline text box inside of it (almost like a log that the app will print to...)
Here's as far as I've been able to get:
self.sb_FoldersToScan = wx.StaticBox(panel, label="Folders to Scan:", size=(200,100))
boxSizer = wx.StaticBoxSizer(self.sb_FoldersToScan, wx.VERTICAL)
boxSizer.Add(self.sb_FoldersToScan, flag=wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT)
multiText = wx.TextCtrl(panel, -1,"test",size=(200, 100), style=wx.TE_MULTILINE)
multiText.SetInsertionPoint(0)
boxSizer.Add(multiText)
sizer.Add(boxSizer, pos=(1, 0), span=(1, 6), flag=wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT)
I've cobbled most of this off the internet -- not trying to do anything right now other than get the layout fixed...
The multiText box shows up directly underneath the StaticBox rather than inside of it? Am I using the wrong control for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你的问题是你将静态框本身添加到了 sizer 中。如果你删除该
行,我怀疑它会起作用。
I think your problem is that you are adding the static box itself to the sizer. If you delete the
line, I suspect it'll work.