<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">Pressing "enter" or "numpad enter" within a TextBox has no effect when using the WxAgg backend</p>
<p dir="auto"><strong>Code for reproduction</strong></p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Based on https://matplotlib.org/3.1.1/gallery/widgets/textbox.html

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import TextBox
import matplotlib as mpl

#mpl.use('TkAgg')  # Enter and numpad enter work fine
#mpl.use('Qt5Agg')  # Enter and numpad enter work fine
mpl.use('WxAgg')  # Neither enter nor numpad enter work

fig, ax = plt.subplots()
plt.subplots_adjust(bottom=0.2)
t = np.arange(-2.0, 2.0, 0.001)
s = t ** 2
initial_text = &quot;t ** 2&quot;
l, = plt.plot(t, s, lw=2)

def submit(text):
    print(text)
    plt.draw()

axbox = plt.axes([0.1, 0.05, 0.8, 0.075])
text_box = TextBox(axbox, 'Evaluate', initial=initial_text)
text_box.on_submit(submit)

plt.show()"><pre class="notranslate"><span class="pl-c"># Based on https://matplotlib.org/3.1.1/gallery/widgets/textbox.html</span>

<span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>
<span class="pl-k">from</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">widgets</span> <span class="pl-k">import</span> <span class="pl-v">TextBox</span>
<span class="pl-k">import</span> <span class="pl-s1">matplotlib</span> <span class="pl-k">as</span> <span class="pl-s1">mpl</span>

<span class="pl-c">#mpl.use('TkAgg')  # Enter and numpad enter work fine</span>
<span class="pl-c">#mpl.use('Qt5Agg')  # Enter and numpad enter work fine</span>
<span class="pl-s1">mpl</span>.<span class="pl-en">use</span>(<span class="pl-s">'WxAgg'</span>)  <span class="pl-c"># Neither enter nor numpad enter work</span>

<span class="pl-s1">fig</span>, <span class="pl-s1">ax</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">subplots</span>()
<span class="pl-s1">plt</span>.<span class="pl-en">subplots_adjust</span>(<span class="pl-s1">bottom</span><span class="pl-c1">=</span><span class="pl-c1">0.2</span>)
<span class="pl-s1">t</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-c1">-</span><span class="pl-c1">2.0</span>, <span class="pl-c1">2.0</span>, <span class="pl-c1">0.001</span>)
<span class="pl-s1">s</span> <span class="pl-c1">=</span> <span class="pl-s1">t</span> <span class="pl-c1">**</span> <span class="pl-c1">2</span>
<span class="pl-s1">initial_text</span> <span class="pl-c1">=</span> <span class="pl-s">"t ** 2"</span>
<span class="pl-s1">l</span>, <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">plot</span>(<span class="pl-s1">t</span>, <span class="pl-s1">s</span>, <span class="pl-s1">lw</span><span class="pl-c1">=</span><span class="pl-c1">2</span>)

<span class="pl-k">def</span> <span class="pl-en">submit</span>(<span class="pl-s1">text</span>):
    <span class="pl-en">print</span>(<span class="pl-s1">text</span>)
    <span class="pl-s1">plt</span>.<span class="pl-en">draw</span>()

<span class="pl-s1">axbox</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">axes</span>([<span class="pl-c1">0.1</span>, <span class="pl-c1">0.05</span>, <span class="pl-c1">0.8</span>, <span class="pl-c1">0.075</span>])
<span class="pl-s1">text_box</span> <span class="pl-c1">=</span> <span class="pl-v">TextBox</span>(<span class="pl-s1">axbox</span>, <span class="pl-s">'Evaluate'</span>, <span class="pl-s1">initial</span><span class="pl-c1">=</span><span class="pl-s1">initial_text</span>)
<span class="pl-s1">text_box</span>.<span class="pl-en">on_submit</span>(<span class="pl-s1">submit</span>)

<span class="pl-s1">plt</span>.<span class="pl-en">show</span>()</pre></div>
<p dir="auto"><strong>Actual outcome</strong></p>
<p dir="auto">With the <code class="notranslate">TkAgg</code> and <code class="notranslate">Qt5Agg</code> backends, pressing "enter" or "numpad enter" within a TextBox work as expected (you see the printed value of the box text in the console).</p>
<p dir="auto">With the WxAgg backend you can enter/delete characters but the enter keys have no effect.</p>
<p dir="auto"><strong>Expected outcome</strong></p>
<p dir="auto">The enter keys should work equally well in all of these backends.</p>
<p dir="auto"><strong>Note:</strong> Clicking into and then out of the TextBox still works regardless of the backend chosen</p>
<p dir="auto"><strong>Matplotlib version</strong></p>

<ul dir="auto">
<li>Operating system: Windows 10</li>
<li>Matplotlib version: 3.1.1</li>
<li>Matplotlib backend (<code class="notranslate">print(matplotlib.get_backend())</code>): See above - problem is with WxAgg</li>
<li>Python version: 3.7.4</li>
<li>Jupyter version (if applicable): n/a</li>
<li>Other libraries: WxPython 4.0.6</li>
</ul>


<p dir="auto">Installed via <code class="notranslate">pip</code>.</p>
<p dir="auto"><strong>Bug summary</strong></p>
<ul dir="auto">
<li>On Windows, with the wx backend, arrow keys are not reported</li>
</ul>
<p dir="auto"><strong>Code for reproduction</strong></p>
<p dir="auto">Use the <a href="http://matplotlib.org/examples/event_handling/keypress_demo.html" rel="nofollow">keypress example</a> and insert:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from matplotlib import use
use('wx')"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">matplotlib</span> <span class="pl-k">import</span> <span class="pl-s1">use</span>
<span class="pl-en">use</span>(<span class="pl-s">'wx'</span>)</pre></div>
<p dir="auto"><strong>Actual outcome</strong></p>
<ul dir="auto">
<li>On Windows, when pressing arrow keys, no keys are printed to the console.</li>
<li>On macOS it works as expected.</li>
</ul>
<p dir="auto"><strong>Matplotlib version</strong></p>
<ul dir="auto">
<li>Matplotlib 2.0.0, Python 2.7, Windows 10</li>
<li>Anaconda</li>
</ul>