From fa51cdb682d792d39921128481fcd097726ccfca Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Fri, 2 Apr 2021 11:09:46 -0400 Subject: clean up --- panel.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/panel.py b/panel.py index a9fab18..a5003fa 100644 --- a/panel.py +++ b/panel.py @@ -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) -- cgit v1.2.3