Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Main = Tk()
- Main.tk_setPalette(background='white')
- Time(Main)
- init()
- GenerateMenus(Main)
- w = GenerateDisplay(Main)
- n = ttk.Notebook(Main, width= 800, height =400)
- n.grid(row=6,column=0, columnspan=9)
- f1 = ttk.Frame(n);
- f2 = ttk.Frame(n);
- n.add(f2, text='Two')
- n.add(f1, text='One')
- GenerateGraph(f1)
- import matplotlib
- matplotlib.use("TkAgg")
- from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
- from matplotlib.figure import Figure
- import matplotlib.animation as animation
- from matplotlib import *
- from random import *
- import Tkinter as tk
- f = Figure(figsize=(5.5,3.5), dpi=120)
- rc("font", size = 7)
- Figure
- a = f.add_subplot(111)
- xList = []
- yList = []
- x= 0
- y = 0
- def animate(i):
- global x
- global y
- xList.append(int(x))
- yList.append(int(y))
- y = randint(0,100)
- x += 5
- a.clear()
- a.plot(xList, yList)
- a.set_ylim(0,100)
- a.set_xlabel("Time (s)")
- a.set_ylabel("Acceleration (m/s2)")
- def GenerateGraph(Master):
- dataPlot = FigureCanvasTkAgg(f, master=Master)
- dataPlot.show()
- dataPlot.get_tk_widget().grid(row=0, column=0)
- toolbar = NavigationToolbar2TkAgg(dataPlot, Master)
- toolbar.update()
- dataPlot._tkcanvas.grid(row=1, column=0)
- dataPlot = FigureCanvasTkAgg(f, master=Master)
- dataPlot.show()
- dataPlot.get_tk_widget().grid(row=0, column=0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement