see _parseHandlers and _addHandler in model.py
should be able to wrap up:
import new
bg.on_btn1_mouseClick = new.instancemethod
(on_btn1_mouseClick, bg, bg.__class__)
So that it does all the necessary Handler calls and
updates the bg._handlers dictionary
Logged In: YES
user_id=228025
>>> bg = pcapp.getCurrentBackground()
>>> comp = bg.components
>>> def on_btn1_mouseClick(self, button, event):
... print "hello"
...
>>> comp['btn1'] =
{'type':'Button', 'name':'btn1', 'position':(0,
30), 'label':'btn1 hello'}
>>> import new
>>> bg.on_btn1_mouseClick = new.instancemethod
(on_btn1_mouseClick, bg, bg.__class__)
could also define the event binding before creating the
widget, but it doesn't seem to matter