SHARE
TWEET

Untitled

a guest Feb 21st, 2020 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class ToggleButton(Button):
  2.     def __init__(self):
  3.         Button.__init__(self)
  4.  
  5.         self.eventUp = None
  6.         self.eventDown = None
  7.  
  8.         self.eventUpArgs = None
  9.         self.eventDownArgs = None
  10.  
  11.     def __del__(self):
  12.         Button.__del__(self)
  13.  
  14.         self.eventUp = None
  15.         self.eventDown = None
  16.  
  17.     def SetToggleUpEvent(self, event, *args):
  18.         self.eventUp = event
  19.         self.eventUpArgs = args
  20.  
  21.     def SetToggleDownEvent(self, event, *args):
  22.         self.eventDown = event
  23.         self.eventDownArgs = args
  24.  
  25.     def RegisterWindow(self, layer):
  26.         self.hWnd = wndMgr.RegisterToggleButton(self, layer)
  27.  
  28.     def OnToggleUp(self):
  29.         if self.eventUp:
  30.             if self.eventUpArgs:
  31.                 apply(self.eventUp, self.eventUpArgs)
  32.             else:
  33.                 self.eventUp()
  34.  
  35.     def OnToggleDown(self):
  36.         if self.eventDown:
  37.             if self.eventDownArgs:
  38.                 apply(self.eventDown, self.eventDownArgs)
  39.             else:
  40.                 self.eventDown()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top