ihatehippies 11 Junior Poster

why does this fail to call any event?

def StartTimer(self, timer = 1):
      timer_data = { 1: (self.TimeKeeper, False, 50),
                     2: (self.InterimSearch, True, 200),
                     3: (self.InterimCurSearch, True, 200),
                     4: (self.SetOpaque, False, 50),
                     5: (self.DisplayPhoto, True, 200)
                     }
      function, singlefire, time = timer_data[timer]
      timer = str(timer)
      # class of constants
      ID = eval('con.TIMER'+timer)
      exec('timer = self.t'+timer+' = wx.Timer(self, id=ID)')
      timer.Bind(wx.EVT_TIMER, Dispatcher(function), id=ID)
      timer.Start(time, singlefire)
   
      self.Timers[timer] = 1
class Dispatcher:
   """ An intermediary between binded events and there routines.
   Allows altering of routines without destroying the initial references """
   def __init__(self, aFunction):
      import __main__
      self.name = aFunction.__name__
      if hasattr(aFunction, 'im_self'):
         self.container = aFunction.im_self
      else:
         self.container = __main__
         

   def __call__(self, *args):
      function = getattr(self.container, self.name)
      return function(*args)