Advertisement
freakrho

MaxIntText

Dec 13th, 2014
8,822
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. class MaxIntText(wt.CTextValidator):
  2.     def __init__(self, parent, aMaxInt, *args, **kwargs):
  3.         self.mMaxInt = aMaxInt
  4.         wt.CTextValidator.__init__(self, parent, *args, **kwargs)
  5.        
  6.     def onChange(self, event):
  7.         tValue = self.GetValue()
  8.         if tValue.isdigit():
  9.             if int(tValue) > self.mMaxInt:
  10.                 self.dontAllow()
  11.         elif tValue != '':
  12.             self.dontAllow()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement