I have a Phidgets stepper controller (Stepper class) and it allows event handlers to be methods of the class:
self.setOnAttachHandler(self.StepperAttached)
self.setOnDetachHandler(self.StepperDetached)
These are useful as they can perform tasks when the stepper controller is attached/detached from the PC.
I have created a Stepper object in a wxFrame in Python and would like to know how to send those messages to the wxFrame so that it can, for example, indicated that the controller has been attached/dettached without polling.
Or in general, how do I send events/messages from object to parent in Python?
Thanks!
The canonical way to do this is to pass a reference of the parent object down into the children.
Hopefully this helps. Code might not be quite accurate, as I don’t have a reference handy, but the principal is the same even if the code above is slightly off.