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

Function test_ginput

lib/matplotlib/tests/test_figure.py:1632–1651  ·  view source on GitHub ↗
(recwarn)

Source from the content-addressed store, hash-verified

1630@pytest.mark.skipif(sys.platform == 'emscripten',
1631 reason='emscripten does not support threads')
1632def test_ginput(recwarn): # recwarn undoes warn filters at exit.
1633 warnings.filterwarnings("ignore", "cannot show the figure")
1634 fig, ax = plt.subplots()
1635 trans = ax.transData.transform
1636
1637 def single_press():
1638 MouseEvent("button_press_event", fig.canvas, *trans((.1, .2)), 1)._process()
1639
1640 Timer(.1, single_press).start()
1641 assert fig.ginput() == [(.1, .2)]
1642
1643 def multi_presses():
1644 MouseEvent("button_press_event", fig.canvas, *trans((.1, .2)), 1)._process()
1645 KeyEvent("key_press_event", fig.canvas, "backspace")._process()
1646 MouseEvent("button_press_event", fig.canvas, *trans((.3, .4)), 1)._process()
1647 MouseEvent("button_press_event", fig.canvas, *trans((.5, .6)), 1)._process()
1648 MouseEvent("button_press_event", fig.canvas, *trans((0, 0)), 2)._process()
1649
1650 Timer(.1, multi_presses).start()
1651 np.testing.assert_allclose(fig.ginput(3), [(.3, .4), (.5, .6)])
1652
1653
1654@pytest.mark.skipif(sys.platform == 'emscripten',

Callers

nothing calls this directly

Calls 3

ginputMethod · 0.80
subplotsMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…