-
-
Save daniilS/bd8a70b17b67ebc716345bc5c922131c to your computer and use it in GitHub Desktop.
Matplotlib embedding issue example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib | |
# force it to use tkinter in case you have multiple GUI frameworks installed | |
matplotlib.use("TkAgg") | |
import matplotlib.pyplot as plt | |
from ttkbootstrap import Style | |
from matplotlib.backends.backend_tkagg import ( | |
FigureCanvasTkAgg, NavigationToolbar2Tk | |
) | |
from matplotlib.figure import Figure | |
root = Style().master | |
fig = Figure() | |
canvas = FigureCanvasTkAgg(fig, master=root) | |
canvas.draw() | |
canvas.get_tk_widget().pack() | |
toolbar = NavigationToolbar2Tk( | |
canvas, root, pack_toolbar=False | |
) | |
toolbar.update() | |
toolbar.pack() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment