1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #!/usr/bin/env python3
-
- # ----------------------------------------------------------------------------
- # "THE BEER-WARE LICENSE" (Revision 42):
- # <xythobuz@xythobuz.de> wrote this file. As long as you retain this notice
- # you can do whatever you want with this stuff. If we meet some day, and you
- # think this stuff is worth it, you can buy me a beer in return. Thomas Buck
- # ----------------------------------------------------------------------------
-
- import time
-
- class Solid:
- def __init__(self, g, t = 1.0, c = (0, 0, 0)):
- self.gui = g
- self.time = t
- self.color = c
- self.restart()
-
- def restart(self):
- self.start = time.time()
-
- def finished(self):
- return (time.time() - self.start) >= self.time
-
- def draw(self):
- for x in range(0, self.gui.width):
- for y in range(0, self.gui.height):
- self.gui.set_pixel(x, y, self.color)
-
- if __name__ == "__main__":
- import platform
- t = None
- if platform.machine() == "armv7l":
- from pi import PiMatrix
- t = PiMatrix()
- else:
- from test import TestGUI
- t = TestGUI()
-
- d = Solid(t, 1.0, (0, 255, 0))
- t.debug_loop(d.draw)
|