<divid="unreleased-message"> You are reading an old version of the documentation (v3.2.0). For the latest version see <ahref="https://matplotlib.org/stable/api/blocking_input_api.html">https://matplotlib.org/stable/api/blocking_input_api.html</a></div>
<spanid="matplotlib-blocking-input"></span><h1><codeclass="docutils literal notranslate"><spanclass="pre">matplotlib.blocking_input</span></code><aclass="headerlink" href="#module-matplotlib.blocking_input" title="Permalink to this headline">¶</a></h1>
<p>This provides several classes used for blocking interaction with figure
windows:</p>
<dlclass="docutils">
<dt><aclass="reference internal" href="#matplotlib.blocking_input.BlockingInput" title="matplotlib.blocking_input.BlockingInput"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">BlockingInput</span></code></a></dt><dd>Creates a callable object to retrieve events in a blocking way for
interactive sessions. Base class of the other classes listed here.</dd>
<dt><aclass="reference internal" href="#matplotlib.blocking_input.BlockingKeyMouseInput" title="matplotlib.blocking_input.BlockingKeyMouseInput"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">BlockingKeyMouseInput</span></code></a></dt><dd>Creates a callable object to retrieve key or mouse clicks in a blocking
way for interactive sessions. Used by <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">waitforbuttonpress</span></code>.</dd>
<dt><aclass="reference internal" href="#matplotlib.blocking_input.BlockingMouseInput" title="matplotlib.blocking_input.BlockingMouseInput"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">BlockingMouseInput</span></code></a></dt><dd>Creates a callable object to retrieve mouse clicks in a blocking way for
interactive sessions. Used by <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">ginput</span></code>.</dd>
<dt><aclass="reference internal" href="#matplotlib.blocking_input.BlockingContourLabeler" title="matplotlib.blocking_input.BlockingContourLabeler"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">BlockingContourLabeler</span></code></a></dt><dd>Creates a callable object to retrieve mouse clicks in a blocking way that
will then be used to place labels on a <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">ContourSet</span></code>. Used by <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">clabel</span></code>.</dd>
<emclass="property">class </em><codeclass="descclassname">matplotlib.blocking_input.</code><codeclass="descname">BlockingContourLabeler</code><spanclass="sig-paren">(</span><em>cs</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/blocking_input.html#BlockingContourLabeler"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.blocking_input.BlockingContourLabeler" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">add_click</code><spanclass="sig-paren">(</span><em>self</em>, <em>event</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/blocking_input.html#BlockingContourLabeler.add_click"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.blocking_input.BlockingContourLabeler.add_click" title="Permalink to this definition">¶</a></dt>
<dd><p>Add the coordinates of an event to the list of clicks.</p>
<codeclass="descname">button1</code><spanclass="sig-paren">(</span><em>self</em>, <em>event</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/blocking_input.html#BlockingContourLabeler.button1"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.blocking_input.BlockingContourLabeler.button1" title="Permalink to this definition">¶</a></dt>
<dd><p>Process an button-1 event (add a label to a contour).</p>
<codeclass="descname">button3</code><spanclass="sig-paren">(</span><em>self</em>, <em>event</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/blocking_input.html#BlockingContourLabeler.button3"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.blocking_input.BlockingContourLabeler.button3" title="Permalink to this definition">¶</a></dt>
<dd><p>Process an button-3 event (remove a label if not in inline mode).</p>
<p>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.</p>
<codeclass="descname">pop_click</code><spanclass="sig-paren">(</span><em>self</em>, <em>event</em>, <em>index=-1</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/blocking_input.html#BlockingContourLabeler.pop_click"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.blocking_input.BlockingContourLabeler.pop_click" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove a click (by default, the last) from the list of clicks.</p>
<emclass="property">class </em><codeclass="descclassname">matplotlib.blocking_input.</code><codeclass="descname">BlockingInput</code><spanclass="sig-paren">(</span><em>fig</em>, <em>eventslist=()</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/blocking_input.html#BlockingInput"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.blocking_input.BlockingInput" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">add_event</code><spanclass="sig-paren">(</span><em>self</em>, <em>event</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/blocking_input.html#BlockingInput.add_event"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.blocking_input.BlockingInput.add_event" title="Permalink to this definition">¶</a></dt>
<dd><p>For base class, this just appends an event to events.</p>
<codeclass="descname">cleanup</code><spanclass="sig-paren">(</span><em>self</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/blocking_input.html#BlockingInput.cleanup"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.blocking_input.BlockingInput.cleanup" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">on_event</code><spanclass="sig-paren">(</span><em>self</em>, <em>event</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/blocking_input.html#BlockingInput.on_event"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.blocking_input.BlockingInput.on_event" title="Permalink to this definition">¶</a></dt>
<dd><p>Event handler; will be passed to the current figure to retrieve events.</p>
<codeclass="descname">pop</code><spanclass="sig-paren">(</span><em>self</em>, <em>index=-1</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.blocking_input.BlockingInput.pop" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove an event from the event list -- by default, the last.</p>
<p>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.</p>
<codeclass="descname">pop_event</code><spanclass="sig-paren">(</span><em>self</em>, <em>index=-1</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/blocking_input.html#BlockingInput.pop_event"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.blocking_input.BlockingInput.pop_event" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove an event from the event list -- by default, the last.</p>
<p>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.</p>
<codeclass="descname">post_event</code><spanclass="sig-paren">(</span><em>self</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/blocking_input.html#BlockingInput.post_event"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.blocking_input.BlockingInput.post_event" title="Permalink to this definition">¶</a></dt>
<dd><p>For baseclass, do nothing but collect events.</p>
<emclass="property">class </em><codeclass="descclassname">matplotlib.blocking_input.</code><codeclass="descname">BlockingKeyMouseInput</code><spanclass="sig-paren">(</span><em>fig</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/blocking_input.html#BlockingKeyMouseInput"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.blocking_input.BlockingKeyMouseInput" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">post_event</code><spanclass="sig-paren">(</span><em>self</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/blocking_input.html#BlockingKeyMouseInput.post_event"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.blocking_input.BlockingKeyMouseInput.post_event" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">add_click</code><spanclass="sig-paren">(</span><em>self</em>, <em>event</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/blocking_input.html#BlockingMouseInput.add_click"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.blocking_input.BlockingMouseInput.add_click" title="Permalink to this definition">¶</a></dt>
<dd><p>Add the coordinates of an event to the list of clicks.</p>
<codeclass="descname">button_add</code><emclass="property"> = 1</em><aclass="headerlink" href="#matplotlib.blocking_input.BlockingMouseInput.button_add" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">button_pop</code><emclass="property"> = 3</em><aclass="headerlink" href="#matplotlib.blocking_input.BlockingMouseInput.button_pop" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">button_stop</code><emclass="property"> = 2</em><aclass="headerlink" href="#matplotlib.blocking_input.BlockingMouseInput.button_stop" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">cleanup</code><spanclass="sig-paren">(</span><em>self</em>, <em>event=None</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/blocking_input.html#BlockingMouseInput.cleanup"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.blocking_input.BlockingMouseInput.cleanup" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">key_event</code><spanclass="sig-paren">(</span><em>self</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/blocking_input.html#BlockingMouseInput.key_event"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.blocking_input.BlockingMouseInput.key_event" title="Permalink to this definition">¶</a></dt>
<dd><p>Process a key press event, mapping keys to appropriate mouse clicks.</p>
<codeclass="descname">mouse_event</code><spanclass="sig-paren">(</span><em>self</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/blocking_input.html#BlockingMouseInput.mouse_event"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.blocking_input.BlockingMouseInput.mouse_event" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">mouse_event_add</code><spanclass="sig-paren">(</span><em>self</em>, <em>event</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/blocking_input.html#BlockingMouseInput.mouse_event_add"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.blocking_input.BlockingMouseInput.mouse_event_add" title="Permalink to this definition">¶</a></dt>
<dd><p>Process an button-1 event (add a click if inside axes).</p>
<codeclass="descname">mouse_event_pop</code><spanclass="sig-paren">(</span><em>self</em>, <em>event</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/blocking_input.html#BlockingMouseInput.mouse_event_pop"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.blocking_input.BlockingMouseInput.mouse_event_pop" title="Permalink to this definition">¶</a></dt>
<dd><p>Process an button-3 event (remove the last click).</p>
<codeclass="descname">mouse_event_stop</code><spanclass="sig-paren">(</span><em>self</em>, <em>event</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/blocking_input.html#BlockingMouseInput.mouse_event_stop"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.blocking_input.BlockingMouseInput.mouse_event_stop" title="Permalink to this definition">¶</a></dt>
<dd><p>Process an button-2 event (end blocking input).</p>
<codeclass="descname">pop</code><spanclass="sig-paren">(</span><em>self</em>, <em>event</em>, <em>index=-1</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/blocking_input.html#BlockingMouseInput.pop"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.blocking_input.BlockingMouseInput.pop" title="Permalink to this definition">¶</a></dt>
<dd><p>Removes a click and the associated event from the list of clicks.</p>
<codeclass="descname">pop_click</code><spanclass="sig-paren">(</span><em>self</em>, <em>event</em>, <em>index=-1</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/blocking_input.html#BlockingMouseInput.pop_click"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.blocking_input.BlockingMouseInput.pop_click" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove a click (by default, the last) from the list of clicks.</p>
<codeclass="descname">post_event</code><spanclass="sig-paren">(</span><em>self</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/blocking_input.html#BlockingMouseInput.post_event"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.blocking_input.BlockingMouseInput.post_event" title="Permalink to this definition">¶</a></dt>