<divid="unreleased-message"> You are reading an old version of the documentation (v3.0.2). For the latest version see <ahref="https://matplotlib.org/stable/gallery/widgets/textbox.html">https://matplotlib.org/stable/gallery/widgets/textbox.html</a></div>
<pclass="last">Click <aclass="reference internal" href="#sphx-glr-download-gallery-widgets-textbox-py"><spanclass="std std-ref">here</span></a> to download the full example code</p>
<spanclass="kn">from</span><spanclass="nn">matplotlib.widgets</span><spanclass="kn">import</span><ahref="../../api/widgets_api.html#matplotlib.widgets.TextBox" title="View documentation for matplotlib.widgets.TextBox"><spanclass="n">TextBox</span></a>
<spanclass="n">fig</span><spanclass="p">,</span><spanclass="n">ax</span><spanclass="o">=</span><ahref="../../api/_as_gen/matplotlib.pyplot.subplots.html#matplotlib.pyplot.subplots" title="View documentation for matplotlib.pyplot.subplots"><spanclass="n">plt</span><spanclass="o">.</span><spanclass="n">subplots</span></a><spanclass="p">()</span>
<ahref="../../api/_as_gen/matplotlib.pyplot.subplots_adjust.html#matplotlib.pyplot.subplots_adjust" title="View documentation for matplotlib.pyplot.subplots_adjust"><spanclass="n">plt</span><spanclass="o">.</span><spanclass="n">subplots_adjust</span></a><spanclass="p">(</span><spanclass="n">bottom</span><spanclass="o">=</span><spanclass="mf">0.2</span><spanclass="p">)</span>
<spanclass="n">t</span><spanclass="o">=</span><ahref="https://docs.scipy.org/doc/numpy/reference/generated/numpy.arange.html#numpy.arange" title="View documentation for numpy.arange"><spanclass="n">np</span><spanclass="o">.</span><spanclass="n">arange</span></a><spanclass="p">(</span><spanclass="o">-</span><spanclass="mf">2.0</span><spanclass="p">,</span><spanclass="mf">2.0</span><spanclass="p">,</span><spanclass="mf">0.001</span><spanclass="p">)</span>
<spanclass="n">l</span><spanclass="p">,</span><spanclass="o">=</span><ahref="../../api/_as_gen/matplotlib.pyplot.plot.html#matplotlib.pyplot.plot" title="View documentation for matplotlib.pyplot.plot"><spanclass="n">plt</span><spanclass="o">.</span><spanclass="n">plot</span></a><spanclass="p">(</span><spanclass="n">t</span><spanclass="p">,</span><spanclass="n">s</span><spanclass="p">,</span><spanclass="n">lw</span><spanclass="o">=</span><spanclass="mi">2</span><spanclass="p">)</span>
<ahref="../../api/_as_gen/matplotlib.pyplot.draw.html#matplotlib.pyplot.draw" title="View documentation for matplotlib.pyplot.draw"><spanclass="n">plt</span><spanclass="o">.</span><spanclass="n">draw</span></a><spanclass="p">()</span>
<spanclass="n">axbox</span><spanclass="o">=</span><ahref="../../api/_as_gen/matplotlib.pyplot.axes.html#matplotlib.pyplot.axes" title="View documentation for matplotlib.pyplot.axes"><spanclass="n">plt</span><spanclass="o">.</span><spanclass="n">axes</span></a><spanclass="p">([</span><spanclass="mf">0.1</span><spanclass="p">,</span><spanclass="mf">0.05</span><spanclass="p">,</span><spanclass="mf">0.8</span><spanclass="p">,</span><spanclass="mf">0.075</span><spanclass="p">])</span>
<spanclass="n">text_box</span><spanclass="o">=</span><ahref="../../api/widgets_api.html#matplotlib.widgets.TextBox" title="View documentation for matplotlib.widgets.TextBox"><spanclass="n">TextBox</span></a><spanclass="p">(</span><spanclass="n">axbox</span><spanclass="p">,</span><spanclass="s1">'Evaluate'</span><spanclass="p">,</span><spanclass="n">initial</span><spanclass="o">=</span><spanclass="n">initial_text</span><spanclass="p">)</span>
<ahref="../../api/_as_gen/matplotlib.pyplot.show.html#matplotlib.pyplot.show" title="View documentation for matplotlib.pyplot.show"><spanclass="n">plt</span><spanclass="o">.</span><spanclass="n">show</span></a><spanclass="p">()</span>
</pre></div>
</div>
<divclass="sphx-glr-footer class sphx-glr-footer-example docutils container" id="sphx-glr-download-gallery-widgets-textbox-py">