ignored run.sh, corrected flicker issue in infodisplay

This commit is contained in:
2017-04-18 23:16:18 -04:00
parent a31f32db5d
commit 64c094d3d0
3 changed files with 49 additions and 99 deletions

47
infodisplay.py Executable file
View File

@@ -0,0 +1,47 @@
#!/usr/bin/python3
import os
import sys
import pygame
import panel
CONFIG_PATH = sys.argv[1]
print(CONFIG_PATH)
pygame.init()
pygame.mouse.set_visible(False)
SIZE = (1280, 1024)
mode = pygame.display.set_mode(SIZE, 1)
pygame.display.set_caption("weather clock")
clock = pygame.time.Clock()
def game_loop():
panel_load = None
parent = None
while True:
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_q:
pygame.quit()
quit()
if event.type == pygame.QUIT:
pygame.quit()
quit()
panel_time = os.stat(CONFIG_PATH).st_mtime_ns
if panel_time != panel_load:
parent = panel.Panel(SIZE, children=panel.load(CONFIG_PATH))
panel_load = panel_time
mode.blit(parent.surf, (0, 0))
pygame.display.update()
clock.tick(8)
game_loop()