wxPython wxComboBox 中的自动完成
我一直在尝试制作一个 ComboBox,它会在您键入时建议选项,很像 IDE 的代码建议/代码感知,或者在您键入搜索时提供谷歌建议。
建议是组合框下拉列表中的项目,其中包含在组合框文本框中键入的子字符串。
我试图让 ComboBox 做到这一点,但没有运气,我尝试过屏蔽 ComboBox,甚至尝试对 ComboCrtl 进行子类化,但我总是遇到性能方面的麻烦或无法执行操作我希望
我的项目列表中有大约 2500 个项目(建议),并且简单地清除组合框并插入匹配的项目太慢了。
我将如何制作这样的组合框,或者是否有我可以使用的内置功能?
在显示建议之前,我可以允许有一点延迟,但在我看来,整个窗口挂起一两秒钟是不可接受的。
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.
The suggestions would be the items from the ComboBox dropdown, which contained the substring typed in the text box of the ComboBox.
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
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.
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.
There is also the Combo Box that Suggests Options