Skip to content

Commit bafa35c

Browse files
authored
Merge pull request #44 from FoamyGuy/size_properties
add height and width properties for Rect and RoundRect
2 parents 26a71a7 + e9850a0 commit bafa35c

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

adafruit_display_shapes/rect.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,17 @@ def outline(self, color):
9595
else:
9696
self._palette[1] = color
9797
self._palette.make_opaque(1)
98+
99+
@property
100+
def width(self) -> int:
101+
"""
102+
:return: the width of the rectangle in pixels
103+
"""
104+
return self._bitmap.width
105+
106+
@property
107+
def height(self) -> int:
108+
"""
109+
:return: the height of the rectangle in pixels
110+
"""
111+
return self._bitmap.height

adafruit_display_shapes/roundrect.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,17 @@ def outline(self, color):
170170
else:
171171
self._palette[1] = color
172172
self._palette.make_opaque(2)
173+
174+
@property
175+
def width(self) -> int:
176+
"""
177+
:return: the width of the rounded rectangle in pixels
178+
"""
179+
return self._bitmap.width
180+
181+
@property
182+
def height(self) -> int:
183+
"""
184+
:return: the height of the rounded rectangle in pixels
185+
"""
186+
return self._bitmap.height

0 commit comments

Comments
 (0)