Adds play on go
This commit is contained in:
@ -24,9 +24,19 @@ class Control(GridFrame):
|
|||||||
self.gobutton = tk.Button(self, bd=0, text='Go', command=lambda : self.set_go(), background='black', foreground='white', activebackground='black', activeforeground='blue')
|
self.gobutton = tk.Button(self, bd=0, text='Go', command=lambda : self.set_go(), background='black', foreground='white', activebackground='black', activeforeground='blue')
|
||||||
self.add(self.gobutton, 0, 2, xspan=2)
|
self.add(self.gobutton, 0, 2, xspan=2)
|
||||||
|
|
||||||
|
def play(self):
|
||||||
|
self.paused = False
|
||||||
|
self.playbutton['text'] = 'Pause'
|
||||||
|
|
||||||
|
def pause(self):
|
||||||
|
self.paused = True
|
||||||
|
self.playbutton['text'] = 'Play'
|
||||||
|
|
||||||
def toggle(self):
|
def toggle(self):
|
||||||
self.paused = not self.paused
|
if self.paused:
|
||||||
self.playbutton['text'] = 'Pause' if not self.paused else 'Play'
|
self.play()
|
||||||
|
else:
|
||||||
|
self.pause()
|
||||||
|
|
||||||
def step(self):
|
def step(self):
|
||||||
self.steps += 1
|
self.steps += 1
|
||||||
@ -40,6 +50,7 @@ class Control(GridFrame):
|
|||||||
|
|
||||||
def set_go(self):
|
def set_go(self):
|
||||||
self.go = True
|
self.go = True
|
||||||
|
self.play()
|
||||||
|
|
||||||
def get_vars(self):
|
def get_vars(self):
|
||||||
return self.entry.a.get(), self.entry.b.get(), self.entry.c.get()
|
return self.entry.a.get(), self.entry.b.get(), self.entry.c.get()
|
||||||
|
|||||||
@ -33,8 +33,9 @@ class MainApplication(GridFrame):
|
|||||||
|
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.primary = Primary(self, *args, **kwargs)
|
self.primary = Primary(self, *args, **kwargs)
|
||||||
self.add(self.primary, 0, 0)
|
self.add(self.primary, 0, 0, )
|
||||||
self.create_widgets()
|
self.create_widgets()
|
||||||
|
GridFrame.configure(self)
|
||||||
|
|
||||||
self.iterations = 0
|
self.iterations = 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user