Skip to content

Commit 5256dcf

Browse files
committed
resize function
1 parent 23c1549 commit 5256dcf

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

adafruit_button.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,3 +336,16 @@ def height(self, new_height):
336336
if self.body:
337337
self.append(self.body)
338338
self.label = self.label
339+
340+
def resize(self, new_width, new_height):
341+
"""Resize the button to the new width and height given
342+
:param new_width int the desired width
343+
:param new_height int the desired height
344+
"""
345+
self._width = new_width
346+
self._height = new_height
347+
self._empty_self_group()
348+
self._create_body()
349+
if self.body:
350+
self.append(self.body)
351+
self.label = self.label

0 commit comments

Comments
 (0)