Hi.
I am trying to play with auto completion.
I have created a class derived from wx.TextCompleter witch contains the following :
import wx
from ClassList import szClasses
class ClassCompleter(wx.TextCompleter):
def init(self):
wx.TextCompleter.init(self)
self._iLastReturned = wx.NOT_FOUND
self._sPrefix = ‘’
def Start(self, prefix):
self._sPrefix = prefix.lower()
self._iLastReturned = wx.NOT_FOUND
for item in szClasses:
if item.lower().startswith(self._sPrefix):
return True
Nothing found
return False
def GetNext(self):
for i in range(self._iLastReturned+1, len(szClasses)):
if szClasses[i].lower().startswith(self._sPrefix):
return szClasses[i]
No more corresponding item
return ‘’
Then, in the main application, I’ve created a simple textbox and enabled auto complete using the following line :
self._txtEntry.AutoComplete(ClassCompleter())
But this line gives an error at execution time :
TypeError: wx._core.TextCompleter cannot be instantiated or sub-classed
OnInit returned false, exiting…
Can one tell me what I’ve done wrong ?
I’m using wxPython 4.0.2a1 dev3717 64bits on a Windows 10 system, installed from the “snapshots builds” wheels (https://wxpython.org/Phoenix/snapshot-builds/).
Thanks in advance.
Regards
Xav’