Passing an event handler through a list

S

StvB

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?
 
H

Heiko Wundram

Am Sonntag, 24. Oktober 2004 18:20 schrieb StvB:
In main.py, I add an event handler to a list:
[snip]

In GUI_Function.py,
def AddItemsToSizer(self, sizer, panel, evtHandlerList ):

Try this, and read up on parameter passing (and also read up on what
*evtHandlerList means...

Heiko.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,054
Latest member
LucyCarper

Latest Threads

Top