You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following will run indefinitely. If an KeyboardInterupt is issued the WebSocket-Transmission will stop but the program will not end. When logging with Verbosity.ALL it will show no further transmission after the first KeyboardInterupt but the whole script won't shutdown.
from pyghthouse import Pyghthouse,VerbosityLevel
from login import username, token
from random import randint
import colorsys
p = Pyghthouse(username, token)
p.start()
img = Pyghthouse.empty_image()
p.set_image(img)
dir_factor=10
dirs=[(0,1),(1,0),(0,-1),(-1,0)]
cur=(0,0)
cur_hue=0
while True:
cur_x,cur_y=cur
while True:
rand_dir_x,rand_dir_y=dirs[randint(0,3)]
next_x,next_y=cur_x+rand_dir_x,cur_y+rand_dir_y
if next_x>=0 and next_y>=0 and next_x<28 and next_y<14:
break
next_hue=(cur_hue+1)%360
img[next_y][next_x]=tuple(round(i * 255) for i in colorsys.hsv_to_rgb(next_hue/360.0,1,1))
cur=(next_x,next_y)
cur_hue=next_hue
p.set_image( img)
The text was updated successfully, but these errors were encountered:
The following will run indefinitely. If an KeyboardInterupt is issued the WebSocket-Transmission will stop but the program will not end. When logging with Verbosity.ALL it will show no further transmission after the first KeyboardInterupt but the whole script won't shutdown.
The text was updated successfully, but these errors were encountered: