In Pys60 1.2 there are 3 types for app.body, namely
They can recieve and process key press.
In older versions, they all have a bind method:
event codes are defined in key_codes module
You can import some or all of them
from key_codes import EKeyLeftArrow, EKeySelect, EKey9, EKeyEdit See diagram for 6630.
In the latest version, Canvas gains ability to respond
to events in more details. You can give it 2 callbacks
when creating a Canvas object.
c = Canvas(redraw_callback=None, event_callback=None)
event_callback will get a dict of the key event containing:
- 'type': one of EEventKeyDown, EEventKey, or EEventKeyUp
- 'keycode': the logical key
- 'scancode': the physical key
- 'modifier': probably about Shift, Ctrl ?
The simplest use is to detect when type=EEventKey
and use the 'keycode' value.
For advanced use, look at keyviewer.py example.