SHARE
TWEET

Untitled

a guest Jun 27th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Main = Tk()
  2. Main.tk_setPalette(background='white')
  3. Time(Main)
  4. init()
  5. GenerateMenus(Main)
  6. w = GenerateDisplay(Main)
  7. n = ttk.Notebook(Main, width= 800, height =400)
  8. n.grid(row=6,column=0, columnspan=9)
  9. f1 = ttk.Frame(n);
  10. f2 = ttk.Frame(n);
  11. n.add(f2, text='Two')
  12. n.add(f1, text='One')
  13. GenerateGraph(f1)
  14.      
  15. import matplotlib
  16. matplotlib.use("TkAgg")
  17. from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
  18. from matplotlib.figure import Figure
  19. import matplotlib.animation as animation
  20. from matplotlib import *
  21. from random import *
  22. import Tkinter as tk
  23.  
  24. f = Figure(figsize=(5.5,3.5), dpi=120)
  25. rc("font", size = 7)
  26. Figure
  27. a = f.add_subplot(111)
  28. xList = []
  29. yList = []
  30. x= 0
  31. y = 0
  32.  
  33. def animate(i):
  34.     global x
  35.     global y
  36.     xList.append(int(x))
  37.     yList.append(int(y))
  38.  
  39.     y = randint(0,100)
  40.     x += 5
  41.  
  42.     a.clear()
  43.     a.plot(xList, yList)
  44.     a.set_ylim(0,100)
  45.     a.set_xlabel("Time (s)")
  46.     a.set_ylabel("Acceleration (m/s2)")
  47.  
  48.  
  49. def GenerateGraph(Master):
  50.     dataPlot = FigureCanvasTkAgg(f, master=Master)
  51.     dataPlot.show()
  52.     dataPlot.get_tk_widget().grid(row=0, column=0)
  53.  
  54.     toolbar = NavigationToolbar2TkAgg(dataPlot, Master)
  55.     toolbar.update()
  56.     dataPlot._tkcanvas.grid(row=1, column=0)
  57.      
  58. dataPlot = FigureCanvasTkAgg(f, master=Master)
  59.      
  60. dataPlot.show()
  61. dataPlot.get_tk_widget().grid(row=0, column=0)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top