Create A Simple Chart In Python GUI Application

Intro

In this blog, I am going to create a simple chart in Python GUI application. It will display a chart on the application screen.

Software requirement

Python 3.5 and IDLE (Python 3.5)

Programming code

  1. #Simple Chart Application  
  2. from pylab import show, arange,sin,plot,pi  
  3. #set x and y values  
  4. x=arange(0.0,2.0,0.01)  
  5. y=sin(2*pi*x)  
  6. plot(x,y)  
  7. #display function  
  8. show()  

About the code

First, I am importing the tkinter modules.

Next, I am assigning the chart x and y values.

Next, displaying the chart in application using the show() function in the code.

Now, let’s execute the code.

Output
 
 
Ebook Download
View all
Learn
View all