-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathgui-testing.py
More file actions
38 lines (27 loc) · 738 Bytes
/
gui-testing.py
File metadata and controls
38 lines (27 loc) · 738 Bytes
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
from tkinter import *
def print_this(x):
print(x)
root = Tk()
root.geometry("750x250")
mousejoy = 0
colors = ['red','lightgrey']
def motion(event):
x, y = event.x, event.y
print('{}, {}'.format(x, y))
def nomotion(event):
pass
def joypad():
global mousejoy
b.configure(bg=colors[mousejoy])
if mousejoy == 0:
root.bind('<Motion>', motion)
# root.bind('<Double-Button-1>', handler) # bind click to stopping motion tracking
mousejoy = 1
else:
root.bind('<Motion>', nomotion)
mousejoy = 0
b = Button(root, command=joypad, text="Testing")
b.pack(anchor=N)
scale = Scale(root, from_=7, to=-7, command=print_this)
scale.pack(anchor=CENTER)
root.mainloop()