Skip to content

Commit c38d42e

Browse files
committed
Added example for set_image usage
1 parent c7ce28c commit c38d42e

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

examples/whitefill.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from pyghthouse import Pyghthouse, VerbosityLevel
2+
from config import UNAME, TOKEN
3+
from time import sleep
4+
5+
6+
def main_loop():
7+
p = Pyghthouse(UNAME, TOKEN, frame_rate=60)
8+
p.start()
9+
10+
img = p.empty_image()
11+
while True:
12+
for y in range(14):
13+
for x in range(28):
14+
img[y][x] = (255, 255, 255)
15+
p.set_image(img)
16+
p.wait()
17+
18+
sleep(1)
19+
20+
for y in range(13, -1, -1):
21+
for x in range(27, -1, -1):
22+
img[y][x] = [0,0,0]
23+
p.set_image(img)
24+
# We skip frames here, but our frame_rate is high enough to hide it
25+
sleep(0.01)
26+
27+
28+
if __name__ == '__main__':
29+
main_loop()

0 commit comments

Comments
 (0)