mirror of
https://gitlab1.ptb.de/waltem01/Matrix
synced 2024-12-26 12:01:45 +00:00
bugfix: optional parameters
This commit is contained in:
parent
0ff0f2ecad
commit
21416fd55a
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
from deps.samplebase import SampleBase
|
from deps.samplebase import SampleBase
|
||||||
from rgbmatrix import graphics
|
from rgbmatrix import graphics
|
||||||
|
from typing import Optional
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
@ -294,7 +295,7 @@ class Matrix(SampleBase):
|
|||||||
self.image = Image.open(requests.get(url, stream=True).raw)
|
self.image = Image.open(requests.get(url, stream=True).raw)
|
||||||
|
|
||||||
# display image at position with dimensions in current color
|
# display image at position with dimensions in current color
|
||||||
def display_image(self, x: int, y: int, w: int|None = None, h: int|None = None):
|
def display_image(self, x: int, y: int, w: Optional[int] = None, h: Optional[int] = None):
|
||||||
# resize image to specified or max size
|
# resize image to specified or max size
|
||||||
self.image.resize((w or self.matrix.width, h or self.matrix.height), Image.ANTIALIAS)
|
self.image.resize((w or self.matrix.width, h or self.matrix.height), Image.ANTIALIAS)
|
||||||
# set image at position
|
# set image at position
|
||||||
|
Loading…
Reference in New Issue
Block a user