matplotlib.blocking_input
#
Classes used for blocking interaction with figure windows:
BlockingInput
Creates a callable object to retrieve events in a blocking way for interactive sessions. Base class of the other classes listed here.
BlockingKeyMouseInput
Creates a callable object to retrieve key or mouse clicks in a blocking way for interactive sessions. Used by
waitforbuttonpress
.BlockingMouseInput
Creates a callable object to retrieve mouse clicks in a blocking way for interactive sessions. Used by
ginput
.BlockingContourLabeler
Creates a callable object to retrieve mouse clicks in a blocking way that will then be used to place labels on a
ContourSet
. Used byclabel
.
- class matplotlib.blocking_input.BlockingContourLabeler(cs)[source]#
Bases:
BlockingMouseInput
Callable for retrieving mouse clicks and key presses in a blocking way.
Used to place contour labels.
- add_click(event)[source]#
Add the coordinates of an event to the list of clicks.
- Parameters:
- event
MouseEvent
- event
- button1(event)[source]#
Process an button-1 event (add a label to a contour).
- Parameters:
- event
MouseEvent
- event
- button3(event)[source]#
Process an button-3 event (remove a label if not in inline mode).
Unfortunately, if one is doing inline labels, then there is currently no way to fix the broken contour - once humpty-dumpty is broken, he can't be put back together. In inline mode, this does nothing.
- Parameters:
- event
MouseEvent
- event
- pop_click(event, index=-1)[source]#
Remove a click (by default, the last) from the list of clicks.
- Parameters:
- event
MouseEvent
- event
- class matplotlib.blocking_input.BlockingInput(fig, eventslist=())[source]#
Bases:
object
Callable for retrieving events in a blocking way.
- pop(index=-1)[source]#
Remove an event from the event list -- by default, the last.
Note that this does not check that there are events, much like the normal pop method. If no events exist, this will throw an exception.
- class matplotlib.blocking_input.BlockingKeyMouseInput(fig)[source]#
Bases:
BlockingInput
Callable for retrieving mouse clicks and key presses in a blocking way.
- class matplotlib.blocking_input.BlockingMouseInput(fig, mouse_add=MouseButton.LEFT, mouse_pop=MouseButton.RIGHT, mouse_stop=MouseButton.MIDDLE)[source]#
Bases:
BlockingInput
Callable for retrieving mouse clicks in a blocking way.
This class will also retrieve keypresses and map them to mouse clicks: delete and backspace are a right click, enter is like a middle click, and all others are like a left click.
- add_click(event)[source]#
Add the coordinates of an event to the list of clicks.
- Parameters:
- event
MouseEvent
- event
- cleanup(event=None)[source]#
- Parameters:
- event
MouseEvent
, optional Not used
- event
- mouse_event_add(event)[source]#
Process an button-1 event (add a click if inside axes).
- Parameters:
- event
MouseEvent
- event
- mouse_event_pop(event)[source]#
Process an button-3 event (remove the last click).
- Parameters:
- event
MouseEvent
- event
- mouse_event_stop(event)[source]#
Process an button-2 event (end blocking input).
- Parameters:
- event
MouseEvent
- event
- pop(event, index=-1)[source]#
Remove a click and the associated event from the list of clicks.
Defaults to the last click.
- pop_click(event, index=-1)[source]#
Remove a click (by default, the last) from the list of clicks.
- Parameters:
- event
MouseEvent
- event