pyGTK组合框列表高度
我刚刚开始使用 pyGtk 编程,所以请耐心等待。我有一个带有组合框的对话框。当我单击组合框时显示的列表中有 70 多次。它从屏幕顶部延伸到底部。我可以接受它,但我宁愿让 ComboBox 像 html 选择元素一样执行(即菜单顶部位于组合框并向下延伸)。我可以设置一些继承的属性吗?到目前为止,我在 API 参考中没有看到任何对我有帮助的内容。
I'm just getting started with pyGtk programming, so bear with me. I have a dialog with a ComboBox. The list that shows up when I click on the combo box has 70+ times in it. It extends from the top of the screen to the bottom. I can live with it, but I'd rather have the ComboBox perform like an html select element(i.e. top of menu is at the combo box and extends down). Is there some inherited property that I can set or something? I'm not seeing anything in the API reference that has helped me so far.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 gtk.ComboBoxEntry 代替 gtk.ComboBox。我已经测试了包含 100 个项目的 ComboBoxEntry,它可以按照您想要的方式工作。缺点是用户可以在其中输入他们想要的任何内容,但您只需要在执行任何操作之前验证输入即可。从好的方面来说,您可以实现自动完成。我见过这样选择字体的。
You can use a gtk.ComboBoxEntry instead of gtk.ComboBox. I have tested a ComboBoxEntry with 100 items and it works how you want. The downside is that the user will be able to type whatever they want into it, but you just need to validate the input before you do anything with it. On the upside you could implement auto-complete. I have seen font selection done this way.