wxPython 中的自动完成 wxComboBox [英] Auto-Completion In wxPython wxComboBox

查看:41
本文介绍了wxPython 中的自动完成 wxComboBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试制作一个 ComboBox,它会在您键入时提出选项建议,就像 IDE 的代码建议/代码感知,或在您键入搜索时的 googles 建议一样.

I've been trying to make a ComboBox which would suggest options as you type, much like an IDE's code suggestions/code-sense, or googles suggestions when you type in a search.

建议是 ComboBox 下拉列表中的项目,其中包含在 ComboBox 的文本框中键入的子字符串.

The suggestions would be the items from the ComboBox dropdown, which contained the substring typed in the text box of the ComboBox.

我曾尝试让 ComboBox 做到这一点,但运气不佳,我尝试了蒙面的 ComboBoxes,甚至尝试对 ComboCrtl 进行子类化,但我总是遇到性能问题或无法实现的问题做我想做的事

I've tried to make a ComboBox do it, with no luck, I've tried the masked ComboBoxes, and have even tried to subclass the ComboCrtl, but I've always run into troubles either performance wise or not being able to do what I want at all

我的项目列表中有大约 2500 个项目(建议),只是清除 ComboBox 并插入匹配的项目太慢了.

I have around 2500 items in my list of items (suggestions), and simply clearing the ComboBox and inserting the items which match is way too slow.

我将如何制作这样的 ComboBox,或者是否有我可以使用的内置功能?

How would I go about making such a ComboBox, or is there even a built-in feature i could use?

我可以允许在显示建议之前稍作延迟,但在我看来,整个窗口悬停一两秒钟是不可接受的.

I can allow a small delay before the suggestions are shown, but the whole window hanging for a second or two is not acceptable, in my oppinion.

推荐答案

几年前,我通过继承 TextCtrl 制作了一个这样的控件.它支持 HTML 格式的建议.给你.

Few years ago I made a control like this by subclassing TextCtrl. It supports HTML formating for suggestions. Here you go.

还有建议选项的组合框

这篇关于wxPython 中的自动完成 wxComboBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆