enable clear() in dev mode
This commit is contained in:
parent
6798e25cb1
commit
5916bff0c7
1 changed files with 13 additions and 1 deletions
|
|
@ -1,5 +1,5 @@
|
|||
from rgbmatrix import RGBMatrix, RGBMatrixOptions
|
||||
from PIL import ImageFont, Image
|
||||
from PIL import ImageFont, Image, ImageDraw
|
||||
#from time import sleep
|
||||
|
||||
# Das Bild nur speichern. Nicht die LED-Matrix ansteuern.
|
||||
|
|
@ -58,5 +58,17 @@ class MyMatrix:
|
|||
"""Get an image buffer with the right dimensions"""
|
||||
return Image.new("RGB", (MATRIX_WIDTH * NUMBER_OF_PANELS, MATRIX_HEIGHT))
|
||||
|
||||
def clear(self):
|
||||
"""Reset the matrix display. Set to black."""
|
||||
if DEV:
|
||||
# Just fill with black
|
||||
image_buffer = self.buffer()
|
||||
draw = ImageDraw.Draw(image_buffer)
|
||||
draw.rectangle( ((0,0),(self.width-1,self.height-1)), fill=(0,0,0) )
|
||||
self.show(image_buffer)
|
||||
else:
|
||||
# Send reset signal to matrix
|
||||
self.matrix.Clear()
|
||||
|
||||
matrix = MyMatrix()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue