MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / waitforbuttonpress

Method waitforbuttonpress

lib/matplotlib/figure.py:3613–3631  ·  view source on GitHub ↗

Blocking call to interact with the figure. Wait for user input and return True if a key was pressed, False if a mouse button was pressed and None if no input was given within *timeout* seconds. Negative values deactivate *timeout*.

(self, timeout=-1)

Source from the content-addressed store, hash-verified

3611 return clicks
3612
3613 def waitforbuttonpress(self, timeout=-1):
3614 """
3615 Blocking call to interact with the figure.
3616
3617 Wait for user input and return True if a key was pressed, False if a
3618 mouse button was pressed and None if no input was given within
3619 *timeout* seconds. Negative values deactivate *timeout*.
3620 """
3621 event = None
3622
3623 def handler(ev):
3624 nonlocal event
3625 event = ev
3626 self.canvas.stop_event_loop()
3627
3628 _blocking_input.blocking_input_loop(
3629 self, ["button_press_event", "key_press_event"], timeout, handler)
3630
3631 return None if event is None else event.name == "key_press_event"
3632
3633 def tight_layout(self, *, pad=1.08, h_pad=None, w_pad=None, rect=None):
3634 """

Callers 3

waitforbuttonpressFunction · 0.80
test_waitforbuttonpressFunction · 0.80

Calls

no outgoing calls

Tested by 1

test_waitforbuttonpressFunction · 0.64