distraction/main.py

22 lines
571 B
Python
Raw Normal View History

2020-02-12 12:01:12 +01:00
import os
2020-02-12 13:32:55 +01:00
import sys
2020-02-12 12:01:12 +01:00
import math
2020-02-12 13:32:55 +01:00
from importlib import import_module
2020-02-12 12:01:12 +01:00
2020-02-12 13:11:57 +01:00
from pixel import Screen
2020-02-12 12:01:12 +01:00
2020-02-12 13:11:57 +01:00
WIDTH, HEIGHT = 100, 30 # Set to -1, -1 for dynamic resolution
STD_HANDLE = 1 # Would want this to be 0, but it can cause issues
2020-02-12 12:01:12 +01:00
2020-02-12 13:32:55 +01:00
if len(sys.argv) < 2: # Randomly select a shader
from glob import glob
from random import choice
2020-02-14 10:29:21 +01:00
module = import_module( choice( glob("shaders/*.py") ).rstrip(".py").replace("\\", ".").replace("/",".") )
2020-02-12 13:32:55 +01:00
else:
module = import_module("shaders.%s" % sys.argv[1])
2020-02-12 12:01:12 +01:00
screen = Screen(WIDTH, HEIGHT, STD_HANDLE, [
2020-02-12 13:32:55 +01:00
module.main
2020-02-12 12:01:12 +01:00
])
screen.mainloop()