I would like to implement auto-completion feature for wx.ComboBox widget. I do something like this in my init method:
self.languages = ['english', 'german']
self.lexer = wx.ComboBox(self, -1, choices=self.languages, style=wx.CB_SORT)
self.Bind(wx.EVT_TEXT, self.on_dropdown_text_change, self.combo)
def on_dropdown_text_change(self, event):
string = self.lexer.GetValue()
items = []
for item in self.languages:
if item.lower().startswith(string.lower()):
items.append(item)
if items:
self.lexer.SetItems(items)
self.lexer.SetValue(items[0])
self.lexer.SetTextSelection(len(string), -1)
So when user inputs something in ComboBox field I would like to highlight the part that was autocompleted. According to docs that should help me link to docs
I use wxPython 3.0 and get this error:
AttributeError: 'ComboBox' object has no attribute 'SetTextSelection'
Am I doing something wrong? Authors covered SetTextSelection method in tests, so, I guess, this method should be in place...