Events
Widgets receive these six event types. Input devices on the app produce them,
and Display routes each to the widget it hits. They are constants on
pd.events; Respond to input shows how to
register for one.
Constant |
Comes from |
Fires when |
|---|---|---|
|
Touch screen, mouse, encoder button |
A touch lands, or a button goes down. |
|
Touch screen, mouse, encoder button |
The touch lifts, or the button is released. |
|
Touch screen, mouse |
The pointer moves, or a finger drags. |
|
Mouse wheel, rotary encoder |
The wheel or encoder turns a step. |
|
Keyboard, keypad |
A key goes down. |
|
Keyboard, keypad |
A key is released. |
Pointer events carry event.pos, the (x, y) of the touch on the display. Key
events carry event.key.
A joystick reports JOYAXISMOTION, JOYBUTTONDOWN and similar events to the
app, but widgets don’t receive them. Listen with app.on(...) and call into
your widgets from there.
The callback signature is callback(sender, event). The value-change callback
set with set_change_cb is separate: it takes callback(widget).