diff options
-rw-r--r-- | panel.py | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -6,14 +6,14 @@ import matplotlib.pyplot as plt from matplotlib.figure import Figure from matplotlib.backends.backend_tkagg import (FigureCanvasTkAgg, NavigationToolbar2Tk) -cnt=1 class Experiment: def __init__(self, root): - self.gui(root) + self.cnt = 1 + self.guiSetup(root) - def gui(self, root): + def guiSetup(self, root): self.bStart=Button(root,text="START",command=self.hello,font=('Arial','24')) self.bStart.pack() @@ -42,17 +42,12 @@ class Experiment: self.canvas.get_tk_widget().pack() def hello(self): - global cnt - cnt = cnt + 1 - self.ax.plot([i for i in range(20)],[i/cnt for i in range(20)]) + self.cnt = self.cnt + 1 + self.ax.plot([i for i in range(20)],[i/self.cnt for i in range(20)]) self.canvas.draw() - print("Hello ") - print(cnt) if __name__ == '__main__': - cnt=1 - root=Tk() Experiment(root) |