Package fife :: Package extensions :: Package pychan :: Module events
[hide private]
[frames] | no frames]

Module events

source code

PyChan event handling (internal).

Users shouldn't need to use this module directly. widgets.Widget.capture and widgets.Widget.mapEvents provide a convenient API to capture events.

Nevertheless to understand how its supposed to work take a look at EventMapper and EventListenerBase

Event callbacks

You can either write callbacks yourself or use tools.callBackWithArguments or tools.attrSetCallback to generate suitable callbacks.

Here's an example callback:

  def dumpEventInfo(event=0,widget=0):
     print widget, " received the event ", event

Note the signature - event and widget are keyword arguments passed to the callback. If doesn't accept either event or widget as argument, these are not passed.

This way a simple function which ignores event or widget can be used, while they are available if needed.

Currently only one callback can be set per event. In case you don't want to write your own callback that dispatches to different callbacks you can use tools.chainCallbacks.

Available Events

Classes [hide private]
  EventListenerBase
Redirector for event callbacks.
  _ActionEventListener
  _MouseEventListener
  _KeyEventListener
  EventMapper
Handles events and callbacks for widgets.Widget and derived classes.
Functions [hide private]
 
getEventType(name) source code
 
splitEventDescriptor(name)
Utility function to split "widgetName/eventName" descriptions into tuples.
source code
Variables [hide private]
  EVENTS = ["mouseEntered", "mouseExited", "mousePressed", "mous...
  CALLBACK_NONE_MESSAGE = "...
Variables Details [hide private]

EVENTS

Value:
["mouseEntered", "mouseExited", "mousePressed", "mouseReleased", "mous\
eClicked", "mouseMoved", "mouseWheelMovedUp", "mouseWheelMovedDown", "\
mouseDragged", "action", "keyPressed", "keyReleased",]

CALLBACK_NONE_MESSAGE

Value:
"""\
You passed None as parameter to %s.capture, which would normally remov\
e a mapped event.
But there was no event mapped. Did you accidently call a function inst\
ead of passing it?
"""