469,323 Members | 1,567 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,323 developers. It's quick & easy.

Passing an event handler through a list

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?


Jul 18 '05 #1
2 1411
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,
---------------------
from wxPython.wx import *
def AddItemsToSizer(self, sizer, panel, evtHandlerList ): [snip]


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

Heiko.
Jul 18 '05 #2
Thanks, I just thought that asterisk had to come in somewhere in the code.
Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Pavils Jurjans | last post: by
2 posts views Thread by Nick | last post: by
6 posts views Thread by vbMark | last post: by
13 posts views Thread by Charles Law | last post: by
3 posts views Thread by Beth | last post: by
5 posts views Thread by Richard Grant | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Gurmeet2796 | last post: by
reply views Thread by mdpf | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.