matplotlib 3.5.1

AttributesNotesBackRef

Attributes

key : None or str

The key(s) pressed. Could be None, a single case sensitive Unicode character ("g", "G", "#", etc.), a special key ("control", "shift", "f1", "up", etc.) or a combination of the above (e.g., "ctrl+alt+g", "ctrl+alt+G").

A KeyEvent has a number of special attributes in addition to those defined by the parent Event and LocationEvent classes.

Notes

Modifier keys will be prefixed to the pressed key and will be in the order "ctrl", "alt", "super". The exception to this rule is when the pressed key is itself a modifier key, therefore "ctrl+alt" and "alt+control" can both be valid key values.

A key event (key press, key release).

Examples

def on_key(event):

print('you pressed', event.key, event.xdata, event.ydata)

cid = fig.canvas.mpl_connect('key_press_event', on_key)

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

matplotlib.backend_bases matplotlib.backend_bases.FigureCanvasBase.key_release_event matplotlib.backend_bases.MouseEvent matplotlib.backend_bases.FigureCanvasBase.mpl_connect matplotlib.backend_bases.FigureCanvasBase.key_press_event matplotlib.pyplot.connect

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /matplotlib/backend_bases.py#1482
type: <class 'type'>
Commit: