nntp2http.com
Posting
Suche
Optionen
Hilfe & Kontakt

Perche questa class validator non mi fa utilizzare i tasti freccia in un textctrl?

Von: news.tin.it (nomail@nomail.com) [Profil]
Datum: 04.07.2008 17:33
Message-ID: <486e42af$0$40160$4fafbaef@reader1.news.tin.it>
Newsgroup: it.comp.lang.python
class CharValidator(wx.PyValidator):
def __init__(self, flag):
wx.PyValidator.__init__(self)
self.flag = flag
self.Bind(wx.EVT_KEY_DOWN , self.OnChar)
def Clone(self):
"""
Note that every validator must implement the Clone()
method.
"""
return CharValidator(self.flag)
def Validate(self, win):
return True
def TransferToWindow(self):
return True
def TransferFromWindow(self):
return True
def OnChar(self, evt):
keycode = evt.GetKeyCode()
print keycode
if keycode<127 :
key = chr(keycode)
if key == 9 or key == 91: return
if key >= " " and key <= "z":
if self.flag == "no-alpha" and key in
string.letters: return
if self.flag == "no-digit" and key in
string.digits: return
evt.Skip()
if keycode>127 : return

[ Auf dieses Posting antworten ]