You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
879 B
Python
33 lines
879 B
Python
1 year ago
|
#!/usr/bin/env python
|
||
|
from samplebase import SampleBase
|
||
|
from rgbmatrix import graphics
|
||
|
import time
|
||
|
|
||
|
|
||
|
class GraphicsTest(SampleBase):
|
||
|
def __init__(self, *args, **kwargs):
|
||
|
super(GraphicsTest, self).__init__(*args, **kwargs)
|
||
|
|
||
|
def run(self):
|
||
|
canvas = self.matrix
|
||
|
font = graphics.Font()
|
||
|
font.LoadFont("../../../fonts/7x13.bdf")
|
||
|
|
||
|
red = graphics.Color(255, 0, 0)
|
||
|
graphics.DrawLine(canvas, 5, 5, 22, 13, red)
|
||
|
|
||
|
green = graphics.Color(0, 255, 0)
|
||
|
graphics.DrawCircle(canvas, 15, 15, 10, green)
|
||
|
|
||
|
blue = graphics.Color(0, 0, 255)
|
||
|
graphics.DrawText(canvas, font, 2, 10, blue, "Text")
|
||
|
|
||
|
time.sleep(10) # show display for 10 seconds before exit
|
||
|
|
||
|
|
||
|
# Main function
|
||
|
if __name__ == "__main__":
|
||
|
graphics_test = GraphicsTest()
|
||
|
if (not graphics_test.process()):
|
||
|
graphics_test.print_help()
|