matplotlib.blocking_input
This provides several 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:
matplotlib.blocking_input.BlockingMouseInput
Callable for retrieving mouse clicks and key presses in a blocking way.
Used to place contour labels.
-
add_click(self, event)
[source] -
Add the coordinates of an event to the list of clicks.
Parameters: -
eventMouseEvent
-
-
Process an button-1 event (add a label to a contour).
Parameters: -
eventMouseEvent
-
-
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: -
eventMouseEvent
-
-
pop_click(self, event, index=- 1)
[source] -
Remove a click (by default, the last) from the list of clicks.
Parameters: -
eventMouseEvent
-
-
-
class matplotlib.blocking_input.BlockingInput(fig, eventslist=())
[source] -
Bases:
object
Callable for retrieving events in a blocking way.
-
add_event(self, event)
[source] -
For base class, this just appends an event to events.
-
cleanup(self)
[source] -
Disconnect all callbacks.
-
on_event(self, event)
[source] -
Event handler; will be passed to the current figure to retrieve events.
-
pop(self, index=- 1)
-
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.
-
pop_event(self, 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.
-
post_event(self)
[source] -
For baseclass, do nothing but collect events.
-
-
class matplotlib.blocking_input.BlockingKeyMouseInput(fig)
[source] -
Bases:
matplotlib.blocking_input.BlockingInput
Callable for retrieving mouse clicks and key presses in a blocking way.
-
post_event(self)
[source] -
Determine if it is a key event.
-
-
class matplotlib.blocking_input.BlockingMouseInput(fig, mouse_add=1, mouse_pop=3, mouse_stop=2)
[source] -
Bases:
matplotlib.blocking_input.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 like mouse button 3, enter is like mouse button 2 and all others are like mouse button 1.
-
add_click(self, event)
[source] -
Add the coordinates of an event to the list of clicks.
Parameters: -
eventMouseEvent
-
-
cleanup(self, event=None)
[source] -
Parameters: -
eventMouseEvent, optional
-
Not used
-
-
key_event(self)
[source] -
Process a key press event, mapping keys to appropriate mouse clicks.
-
mouse_event(self)
[source] -
Process a mouse click event.
-
mouse_event_add(self, event)
[source] -
Process an button-1 event (add a click if inside axes).
Parameters: -
eventMouseEvent
-
-
mouse_event_pop(self, event)
[source] -
Process an button-3 event (remove the last click).
Parameters: -
eventMouseEvent
-
-
mouse_event_stop(self, event)
[source] -
Process an button-2 event (end blocking input).
Parameters: -
eventMouseEvent
-
-
pop(self, event, index=- 1)
[source] -
Removes a click and the associated event from the list of clicks.
Defaults to the last click.
-
pop_click(self, event, index=- 1)
[source] -
Remove a click (by default, the last) from the list of clicks.
Parameters: -
eventMouseEvent
-
-
post_event(self)
[source] -
Process an event.
-
© 2012–2018 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/3.2.2/api/blocking_input_api.html