471,857 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,857 software developers and data experts.

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 1467
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
NeoPa
reply views Thread by NeoPa | last post: by
reply views Thread by YellowAndGreen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.