Home > Enterprise >  How do i create a button on tkinter that opens up a matplotlib graph
How do i create a button on tkinter that opens up a matplotlib graph

Time:04-09

I'm trying to create a button on tkinter that opens a matplotlib button but i don't know how to do do that.

CodePudding user response:

I dont know what you want but you want to put the the matplotlib graph in a def, and make the button for that command so like

import tkinter as tk
from tkinter import Button

root = tk.Tk()
root.geometry('300x400')

def mathplotlibgraph():
    mathplotlibcode

b1 = Button(root, text = 'Mathplotlib', command = mathplotlibgraph)
b1.pack()
  • Related