python - SetTextSelection method of wx.ComboBox widget -
i implement auto-completion feature wx.combobox widget. in 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 = [] 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 in combobox field highlight part autocompleted. according docs should me link docs
i use wxpython 3.0 , error:
attributeerror: 'combobox' object has no attribute 'settextselection'
am doing wrong? authors covered settextselection method in tests, so, guess, method should in place...
Comments
Post a Comment