Tkinter Python GUI Tutorial For Beginners 13- How to embed Matplotlib graph to Tkinter GUI


Welcome to this video on Tkinter Python GUI Tutorial For Beginners. This video shows How to embed a Matplotlib graph to your Tkinter GUI.

Find the code used in this video here –

So What is Tkinter ? Tkinter is the Python interface to the Tk GUI toolkit shipped with Python. In Python you can use the Tkinter module to create simple GUI programs. Tkinter does not always run reliably under IDLE Use IDLE’s editor to write GUI programs, but for best results run the program from the OS command line. Learn Tkinter In easy and simple steps.

#ProgrammingKnowledge #Tkinter #PythonGUITutorial
★★★Top Online Courses From ProgrammingKnowledge ★★★
Python Programming Course ➡️ ⚫️
Java Programming Course ➡️ ⚫️
Bash Shell Scripting Course ➡️ ⚫️
Linux Command Line Tutorials ➡️ ⚫️
C Programming Course ➡️ ⚫️
C++ Programming Course ➡️ ⚫️
PHP Programming Course ➡️ ⚫️
Android Development Course ➡️ ⚫️
C# Programming Course ➡️ ⚫️
JavaFx Programming Course ➡️ ⚫️
NodeJs Programming Course ➡️ ⚫️
Jenkins Course For Developers and DevOps ➡️ ⚫️
Scala Programming Tutorial Course ➡️ ⚫️
Bootstrap Responsive Web Design Tutorial ➡️ ⚫️
MongoDB Tutorial Course ➡️ ⚫️
QT C++ GUI Tutorial For Beginners ➡️

★★★ Online Courses to learn ★★★
Get 2 FREE Months of Unlimited Classes from skillshare –
Data Science – |
Machine Learning – |
Artificial Intelligence – |
MERN Stack E-Degree Program – |
DevOps E-degree – |
Data Analytics with R – |
AWS Certification Training – |
Projects in Java – |
Machine Learning With TensorFlow – |
Angular 8 – Complete Essential Guide –
Kotlin Android Development Masterclass –
Learn iOS Programming Building Advance Projects –

★★★ Follow ★★★
My Website –

DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This help support the channel and allows us to continue to make videos like this. Thank you for the support!



Comment List

  • ProgrammingKnowledge
    December 18, 2020

    You have just copy the code of matplotlib documentation and I don't think that you have any idea about this . First learn yourself clearly.

  • ProgrammingKnowledge
    December 18, 2020

    my text editor says can't invoke button command: application has been destroyed

  • ProgrammingKnowledge
    December 18, 2020

    Thanks for the video. It helped a lot in some basic understanding of programming GUI in python. I have one question: the function on_key(event) seems to never be called when program is running. I tried to remove it and it worked perfectly without it. I also placed marker for debugging on one line in that function and I couldn't notice moment when program calls that function. I'm asking because I want to understand the meaning of that function but it seem that it works nothing.
    Also when I comment canvas.draw() and run program everything stays the same. program works without it, and I couldn't notice the difference.

  • ProgrammingKnowledge
    December 18, 2020

    I have a code that allows me to plot 2 signals from Arduino.
    I have not being able to embed them into tkinter.
    All i get is 2 different windows.
    I appreciate your help.
    Here is my code.
    import time

    import csv

    import matplotlib


    import matplotlib.pyplot as plt

    import numpy as np

    from time import perf_counter

    import serial

    ser = serial.Serial('COM4')


    plot_window = 20

    y_var = np.array(np.zeros([plot_window]))

    y_var2 = np.array(np.zeros([plot_window]))




    fig, ax = plt.subplots()

    line, = ax.plot(y_var)

    line2, = ax.plot(y_var2)

    while True:



    ser_byte = ser.readline().decode("utf-8").split(',')

    ser_bytes = ser_byte[0]

    ser_bytes2 = ser_byte[1]


    decoded_bytes = float(ser_bytes[0:len(ser_bytes)-2])

    decoded_bytes2 = float(ser_bytes2[0:len(ser_bytes2)-2])




    with open("test_data.csv","a") as f:

    writer = csv.writer(f,delimiter=",")


    y_var = np.append(y_var,decoded_bytes)

    y_var2 = np.append(y_var2,decoded_bytes2)

    y_var = y_var[1:plot_window+1]

    y_var2 = y_var2[1:plot_window+1]








    print("Keyboard Interrupt")


  • ProgrammingKnowledge
    December 18, 2020

    Very good vedio sir

  • ProgrammingKnowledge
    December 18, 2020

    Thank you

  • ProgrammingKnowledge
    December 18, 2020


    Need your help. Could please tell me that can we image as facecolor in matplolib or can we insert image as background in matplolib graph??
    Thanks and Regards.

  • ProgrammingKnowledge
    December 18, 2020

    Thanks for the video. I had the same mistake as @Netchaiev
    : "AttributeError: 'FigureCanvasTkAgg' object has no attribute 'manager'"
    Could you help us, please?

  • ProgrammingKnowledge
    December 18, 2020

    Great video! I have just one issue : when I push the "save" button in the toolbar, I get :
    "AttributeError: 'FigureCanvasTkAgg' object has no attribute 'manager'"
    I didn't find much about this issue on the internet, somebody knows how to fix this/had the same issue?

  • ProgrammingKnowledge
    December 18, 2020

    Your audio quality has deteriorated. Please fix it. You are closing in on 1M subscribers!

  • ProgrammingKnowledge
    December 18, 2020

    Nice video

  • ProgrammingKnowledge
    December 18, 2020

    First watched this

  • ProgrammingKnowledge
    December 18, 2020


Write a comment