Passing an event handler through a list

StvB mesteve_bpleaseremovethis at hotmail.com
Sun Oct 24 12:20:45 EDT 2004


Hi, I'm now trying to separate my wxPython GUI-building code into different 
files,
  and ran into a bump:

In main.py, I add an event handler to a list:
----------------------
  # -- add the event handler to  list
  lstEvtHandler.append(self.OnNodeChanged)

 # -- call the function in the other py file
 GUI_Function.AddItemsToSizer(self, self.leftSizer, \
              self.MyLeftPanel, lstEvtHandler )


In GUI_Function.py,
---------------------
from   wxPython.wx import *

def AddItemsToSizer(self, sizer, panel, *evtHandlerList ):

#  .. create a tree, put a newId into treeID,

    EVT_TREE_SEL_CHANGED(self.tree, treeID, evtHandlerList[0])

What I get here is:
   TypeError: Expected callable object or None.


Can you pass a handler in this way?

 





More information about the Python-list mailing list