Jan-10-2018, 12:21 PM
Actually, i am pasting 2 code segments. The first code segment is generate the graph using matplotlib. while, second segment of code is for the usual tkinter window with tabs.
Now my question is that "How i can embed matplotlib plot of first segment of code into the tkinter window i.e. second segment of code?"
I am expecting same graph should be produced in tkinter window. I have gone through various tutorials available online and studied canvas method via figure but could not embed.
First Segment of Code:
Now my question is that "How i can embed matplotlib plot of first segment of code into the tkinter window i.e. second segment of code?"
I am expecting same graph should be produced in tkinter window. I have gone through various tutorials available online and studied canvas method via figure but could not embed.
First Segment of Code:
import matplotlib.pyplot as plt import pandas url = "https://archive.ics.uci.edu/ml/machine-learning-databases/pima-indians-diabetes/pima-indians-diabetes.data" names = ['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class'] data = pandas.read_csv(url, names=names) data.hist() plt.show()Second Segment of Code:
import tkinter as tk from tkinter import ttk root = tk.Tk() root.minsize(300, 300) root.geometry("1000x700") s = ttk.Style() s.configure('TNotebook', tabposition='ne') #'ne' as in compass direction box = ttk.Notebook(root, width=1000, height=650) tab1 = tk.Frame(root) tab2 = tk.Frame(root) tab3 = tk.Frame(root) box.add(tab1, text="tab1") box.add(tab2, text="tab2") box.add(tab3, text="tab3") box.pack(side=tk.TOP) root.mainloop()Both codes are working fine separately, i tried lot but could not embed...plz check it out once. Thanks in Advance