allow to change color in interactive mode

Signed-off-by: Thomas Schmid <tom@lfence.de>
This commit is contained in:
Thomas 2021-07-27 22:52:29 +02:00
parent 5b9b69e440
commit 3ebdfc93e5
1 changed files with 14 additions and 2 deletions

16
main.py
View File

@ -66,8 +66,10 @@ def interactive(an, config):
x = 0
y = 0
color_keys = list(COLORS.keys())
c = 0
set_color(an, 0x100)
set_color(an, COLORS[color_keys[c]])
print_pos = lambda x,y: print(f"x:{x} y:{y}")
@ -84,6 +86,16 @@ def interactive(an, config):
if keyboard.is_pressed("d"):
y = y + 1
print_pos(x,y)
if keyboard.is_pressed(" "):
pass
#save point in config file
if keyboard.is_pressed("c"):
c = c + 1
if c >= len(color_keys):
c = 0
set_color(an, COLORS[color_keys[c]])
set_pos(an, (x, y))
time.sleep(0.05)
@ -115,7 +127,7 @@ def main(args):
c = random.choice(list(COLORS.values()))
else:
c = COLORS.get(p.color)
set_color(an, c)
# wait random amount of times