]> Repositories - hackapet/Adafruit_Blinka_Displayio.git/commitdiff
Merge pull request #90 from FoamyGuy/size_props
authorMelissa LeBlanc-Williams <melissa@adafruit.com>
Mon, 16 May 2022 19:02:17 +0000 (13:02 -0600)
committerGitHub <noreply@github.com>
Mon, 16 May 2022 19:02:17 +0000 (13:02 -0600)
size properties for TileGrid

displayio/_tilegrid.py

index 25b0c73ce83e0434ab5b8b46a9f91a83663eacb9..999ddb225316fe993ae1ed6b527b3efeb5d877a3 100644 (file)
@@ -408,3 +408,23 @@ class TileGrid:
         if not 0 <= value <= 255:
             raise ValueError("Tile value out of bounds")
         self._tiles[index] = value
+
+    @property
+    def width(self) -> int:
+        """Width in tiles"""
+        return self._width
+
+    @property
+    def height(self) -> int:
+        """Height in tiles"""
+        return self._height
+
+    @property
+    def tile_width(self) -> int:
+        """Width of each tile in pixels"""
+        return self._tile_width
+
+    @property
+    def tile_height(self) -> int:
+        """Height of each tile in pixels"""
+        return self._tile_height