Implementing matplotlib figure in tkinter

by Kacper Ta┼║bierski   Last Updated January 13, 2018 14:24 PM

I have a problem with implementing a matplotlib figure inside a tkinter window. Following other threads, i managed to do so, but i don't want the figure itself to be seen outside of the tkinter window as well as on the inside. The part of the code responsible for the plot:

from tkinter import *
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg

fig = plt.figure(1)
plt.ion()

root = Tk()
canvas = FigureCanvasTkAgg(fig,master=root)
plot_widget = canvas.get_tk_widget().grid(column = 1, row = 1, rowspan = 11)
while True:
    #data updating
    fig.canvas.draw()
    plt.pause(0.5)
root.mainloop()

Thank you very much in advance!

Tags : discussion


Related Questions


Vmware virtual format

Updated March 26, 2015 07:30 AM

What you claim is not what you try to deliver

Updated March 26, 2015 07:30 AM

I am on Facebook of

Updated March 27, 2015 05:08 AM

Is asking for a test API endpoint off topic?

Updated January 03, 2018 07:24 AM