The current example in proof.py requires creating a
class then sending:
msgEvent = MessageEvent( 'button1', 'doClick', None,
self )
self.postEvent( self, msgEvent, None )
Can it be simplified so the user code is reduced to?
...postEvent(widgetOrObjectName, eventName)
Somehow, we have to be able to specify different cards
and backgrounds as part of the identifier, so messages
can be sent to particular cards or backgrounds or
specific widgets on a card or background.
There is a postEvent defined in both model.py and
event.py
The event name should correspond to the name in the
user code, so "mouseClick" instead of "doClick" and
then postEvent can translate the string into the
corresponding event class.
Logged In: YES
user_id=228025
I'm not sure any of this is still relevant for PythonCard 1.0.
You can just call a an event handler directly passing an arg of
None (e.g. self.on_btn1_mouseClick(None) ) to run the code
in an event handler that doesn't make use of the event arg.
Actually generating a real event would require constructing a
real wxPython event. Among other things we probably need
to abstract out a mapper between PythonCard event names
and the corresponding wxPython event id and binding
function. We have partly done that. Then we would have to
figure out what additional args are required to set key codes,
mouse position, event target, etc.
Maybe all that would be part of out testing infrastructure and
event simulation, so it would be worth building as part of
PythonCard 1.x?!