wx.combobox 由 sizer 管理?
我一直在网上浏览,我看到的所有示例都有 wx.ComboBox 或 wx.Choice 的给定 pos=(x,y) 属性。但是,我需要让组合框(或等效的小部件)的位置由我的大小调整器管理。做法:
itemSelect = wx.ComboBox(self, choices = list, style = wx.CB_DROPDOWN)
itemSelect.AppendItems(strings=list)
itemSelect.Select(n=0)
itemSizer.Add(itemSelect, 1, wx.EXPAND)
这将创建组合框,但它显示在错误的位置。这应该有效还是可以将其添加到 sizer 中?
问候, 博格丹
I've been looking around the web and all the examples I've seen have a given pos=(x,y) attribute for a wx.ComboBox or wx.Choice. However I need to let the position of the combobox (or an equivalent Widget) be managed by my sizer. Doing:
itemSelect = wx.ComboBox(self, choices = list, style = wx.CB_DROPDOWN)
itemSelect.AppendItems(strings=list)
itemSelect.Select(n=0)
itemSizer.Add(itemSelect, 1, wx.EXPAND)
This creates the combobox but it is displayed in wrong positions. Should this work or is it another way to add it to the sizer ?
Regards,
Bogdan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设还有更多代码未向我们展示,您的代码应该可以工作。您是否正在调用 self.SetSizer(itemSizer) 来将 sizer 与您的容器小部件关联起来?
Your code should work, assuming there is more code you aren't showing us. Are you calling
self.SetSizer(itemSizer)
to associate the sizer with you container widget?