如何使 FlexGridSizer 中的 wxTextCtrl 全部为 'x'线高?
我有一个长度未知的 key:val
对数组。每对占据 FlexGridSizer
中的一行。键位于第一列中,如 wx.StaticText
s,值位于第二列中,如 wx.TextCtrl
s。
问题是没有太多可用空间,并且一些 val 相对较长,不适合 wx.TextCtrl
。我希望所有 wx.TextCtrl
的高度可能为 2 或 3 行。
我尝试过使用 style = wx.TE_MULTILINE,但这只是添加了一个垂直滚动条,而不是使用左/右/home/end 等水平滚动的默认行为。
有什么想法吗?
I have an array, of unknown length, of key:val
pairs. Each pair occupies a row in a FlexGridSizer
. The keys are in the first column, as wx.StaticText
s, and the vals are in the second column, as wx.TextCtrl
s.
The problem is that there isn't a lot of room available, and some of the vals are relatively long, and don't fit in the wx.TextCtrl
s. I would like to have all of the wx.TextCtrl
s be maybe 2 or 3 lines in height.
I've tried using style = wx.TE_MULTILINE
, but that just adds a vertical scrollbar, as opposed to the default behaviour of scrolling horizontally with left/right/home/end etc.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我建议你使用wxGrid。
http://docs.wxwidgets.org/2.9.2/overview_grid.html
I suggest you use wxGrid.
http://docs.wxwidgets.org/2.9.2/overview_grid.html
根据 wx.TextCtrl 的文档,您可以对其应用 wx.HSCROLL 样式以使控件具有水平滚动条,但这在基于 GTK1 的系统上不起作用: http://xoomer.virgilio.it/infinity77/wxPython/Widgets/wx.TextCtrl.html
您可能还想查看一个 ExpandoTextCtrl: from wx.lib.expando import ExpandoTextCtrl(有关示例,请参阅 wxPython 演示)
According to the documentation for the wx.TextCtrl, you can apply the wx.HSCROLL style to it to make the control have a horizontal scrollbar, but this won't work on GTK1-based systems: http://xoomer.virgilio.it/infinity77/wxPython/Widgets/wx.TextCtrl.html
There's also an ExpandoTextCtrl that you might want to look at: from wx.lib.expando import ExpandoTextCtrl (see the wxPython demo for an example)
我最终使用了 FlexGridSizer。我使每个 val 单元格跨越两行,并在每个键下方添加了空的 wx.Size() 。结果是这样的:
I ended up using
FlexGridSizer
. I made each of the val cells span across two rows, and added emptywx.Size()
s below each key. The result is something like this: