mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-07 20:40:11 +01:00
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71161 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
30 lines
887 B
Python
30 lines
887 B
Python
|
|
class MyTextCompleter(wx.TextCompleterSimple):
|
|
|
|
def __init__(self):
|
|
|
|
wx.TextCompleterSimple.__init__(self)
|
|
|
|
|
|
def GetCompletions(self, prefix, res):
|
|
|
|
firstWord = prefix.split()[0]
|
|
|
|
if firstWord == "white":
|
|
res.append("white pawn")
|
|
res.append("white rook")
|
|
|
|
elif firstWord == "black":
|
|
res.append("black king")
|
|
res.append("black queen")
|
|
|
|
else:
|
|
res.append("white")
|
|
res.append("black")
|
|
|
|
|
|
# Later on...
|
|
text = wx.TextCtrl(parent, wx.ID_ANY, 'My Text')
|
|
text.AutoComplete(MyTextCompleter)
|
|
|