In this article, we are going to see matplotlib’s textbox widget. Matplotlib is a plotting library for the Python programming language. In this article, we will try to plot a graph for different powers(e.g. t^2, t^3, t^9, etc.) using textbox widget.
The Textbox is a widget that accepts input from the user. Input can also be formulas so that we can generate a graph based on those formulas. To use this widget we use TextBox() function.
It accepts two parameters
- Figure i.e. graph to use.
- Text to display with textbox i.e. Label to txtBox.
Below is the implementation of this widget:
In the above program, we created a graph for t2 as by default graph. In txtBox labelled as Plot: we can enter the formula we want to view the graph for.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.