-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathButton.py
More file actions
31 lines (29 loc) · 869 Bytes
/
Button.py
File metadata and controls
31 lines (29 loc) · 869 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
button_count = 9
button_size = 80
button_y = 30
button_names = [
"Create",
"Create Bulk",
"Grabbing",
"Delete",
"Delete Bulk",
"Delete All",
"Debug \nmode",
"Change \nColor",
"Change \nBulk Color"
]
button_states = [True, False, False, False, False, False, False, False, False]
def button_draw(w):
button_spacing = (w - button_size * button_count) / (button_count + 1)
for i in range(button_count):
button_x = button_spacing * (i + 1) + button_size * i
fill(255)
stroke(0)
strokeWeight(5)
if button_states[i]:
fill(100) # Green color for pressed buttons
rect(button_x, button_y, button_size, button_size)
textSize(14)
textAlign(CENTER, CENTER)
fill(0)
text(button_names[i], button_x + button_size / 2, button_y + button_size / 2)