-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtkinter_gui_user_input.py
48 lines (39 loc) · 1.34 KB
/
tkinter_gui_user_input.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# TODO:
# A. Placeholder
class TkinterGuiUserInput():
def __init__(self, wrapper_, app_):
self.wrapper = wrapper_
self.app = app_
# Mouse Left Click - Advances the state
def handleMouseClick(self, event=None):
if event:
print(event.x, event.y)
self.wrapper.gEngines[-1].randomizeRandomPixel()
self.app.advance()
# Keyboard "ENTER" Press - Begins the animation process
def handleKeyEnter(self, event=None):
if event:
print(event)
if not self.app.animating:
self.app.startAnimating()
# Keyboard "SPACE" Press - Pauses the animation process
def handleKeySpace(self, event=None):
if event:
print(event)
self.app.stopAnimating()
# Keyboard "C" Press - Clears/Resets the image
def handleKeyC(self, event=None):
if event:
print(event)
if self.app.animating:
self.app.stopAnimating()
self.wrapper.gEngines[-1].numpyImage = self.wrapper.gEngines[-1].clearImageNumba(
self.wrapper.gEngines[-1].numpyImage)
self.app.advance()
# Keyboard "D" Press - Advances the state
def handleKeyD(self, event=None):
if event:
print(event)
if self.app.animating:
self.app.stopAnimating()
self.app.advance()