Advertisement
freakrho

TextValidator

Dec 13th, 2014
8,819
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. class TextValidator(wx.TextCtrl):
  2.     def __init__(self, parent, *args, **kwargs):
  3.         wx.TextCtrl.__init__(self, parent, *args, **kwargs)
  4.        
  5.         self.mCurValue = ''
  6.    
  7.         self.Bind(wx.EVT_CHAR, self.onChar)
  8.         self.Bind(wx.EVT_TEXT, self.onChange)
  9.    
  10.     def dontAllow(self):
  11.         self.SetValue(self.mCurValue)
  12.    
  13.     def onChar(self, event):
  14.         self.mCurValue = self.GetValue()
  15.         event.Skip()
  16.    
  17.     def onChange(self, event):
  18.         '''
  19.        override with validator
  20.        '''
  21.         pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement