aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--panel.py15
1 files 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)