Skip to content

Commit 252cf7d

Browse files
committed
Button.py second pass
Second pass to finalize changes
1 parent ae6ced5 commit 252cf7d

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

adafruit_button/button.py

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,24 @@ class Button(ButtonBase):
4848
:param int y: The y position of the button.
4949
:param int width: The width of the button in pixels.
5050
:param int height: The height of the button in pixels.
51-
:param str name: The name of the button.
51+
:param Optional[str] name: The name of the button.
5252
:param style: The style of the button. Can be RECT, ROUNDRECT, SHADOWRECT, SHADOWROUNDRECT.
5353
Defaults to RECT.
54-
:param int|Tuple(int, int, int) fill_color: The color to fill the button. Defaults to 0xFFFFFF.
55-
:param int|Tuple(int, int, int) outline_color: The color of the outline of the button.
56-
:param str label: The text that appears inside the button.
57-
:param FontProtocol label_font: The button label font. Defaults to ''terminalio.FONT''
58-
:param int|Tuple(int, int, int) label_color: The color of the button label text. Defaults to 0x0.
59-
:param int|Tuple(int, int, int) selected_fill: The fill color when the button is selected.
60-
Defaults to the inverse of the fill_color.
61-
:param int|Tuple(int, int, int) selected_outline: The outline color when the button is selected.
62-
Defaults to the inverse of outline_color.
63-
:param selected_label: The label color when the button is selected.
64-
Defaults to inverting the label_color.
54+
:param Optional[Union[int, Tuple[int, int, int]]] fill_color: The color to fill the button.
55+
Accepts an int or a tuple of 3 integers representing RGB values. Defaults to 0xFFFFFF.
56+
:param Optional[Union[int, Tuple[int, int, int]]] outline_color: The color of the outline of the button.
57+
Accepts an int or a tuple of 3 integers representing RGB values. Defaults to 0x0.
58+
:param Optional[str] label: The text that appears inside the button.
59+
:param Optional[FontProtocol] label_font: The button label font. Defaults to ''terminalio.FONT''
60+
:param Optional[Union[int, Tuple[int, int, int]]] label_color: The color of the button label text.
61+
Accepts an int or a tuple of 3 integers representing RGB values. Defaults to 0x0.
62+
:param Optional[Union[int, Tuple[int, int, int]]] selected_fill: The fill color when the button is selected.
63+
Accepts an int or a tuple of 3 integers representing RGB values. Defaults to the inverse of the fill_color.
64+
:param Optional[Union[int, Tuple[int, int, int]]] selected_outline: The outline color when the button is selected.
65+
Accepts an int or a tuple of 3 integers representing RGB values. Defaults to the inverse of outline_color.
66+
:param Optional[Union[int, Tuple[int, int, int]]] selected_label: The label color when the button is selected.
67+
Accepts an int or a tuple of 3 integers representing RGB values. Defaults to inverting the label_color.
68+
:param Optional[int] label_scale: The scale factor used for the label. Defaults to 1.
6569
"""
6670

6771
def _empty_self_group(self) -> None:
@@ -140,7 +144,7 @@ def __init__(
140144
outline_color: Optional[Union[int, tuple[int, int, int]]] = 0x0,
141145
label: Optional[str] = None,
142146
label_font: Optional[FontProtocol] = None,
143-
label_color: Optional[int] = 0x0,
147+
label_color: Optional[Union[int, tuple[int, int , int]]] = 0x0,
144148
selected_fill: Optional[Union[int, tuple[int, int , int]]] = None,
145149
selected_outline: Optional[Union[int, tuple[int, int, int]]] = None,
146150
selected_label: Optional[Union[int, tuple[int, int, int]]] = None,
@@ -217,7 +221,7 @@ def fill_color(self) -> Optional[int]:
217221
return self._fill_color
218222

219223
@fill_color.setter
220-
def fill_color(self, new_color: Optional[Union[int, tuple[int, int, int]]]) -> None:
224+
def fill_color(self, new_color: Union[int, tuple[int, int, int]]) -> None:
221225
self._fill_color = _check_color(new_color)
222226
if not self.selected:
223227
self.body.fill = self._fill_color
@@ -228,7 +232,7 @@ def outline_color(self) -> Optional[int]:
228232
return self._outline_color
229233

230234
@outline_color.setter
231-
def outline_color(self, new_color: Optional[Union[int, tuple[int, int, int]]]) -> None:
235+
def outline_color(self, new_color: Union[int, tuple[int, int, int]]) -> None:
232236
self._outline_color = _check_color(new_color)
233237
if not self.selected:
234238
self.body.outline = self._outline_color
@@ -239,7 +243,7 @@ def selected_fill(self) -> Optional[int]:
239243
return self._selected_fill
240244

241245
@selected_fill.setter
242-
def selected_fill(self, new_color: Optional[Union[int, tuple[int, int, int]]]) -> None:
246+
def selected_fill(self, new_color: Union[int, tuple[int, int, int]]) -> None:
243247
self._selected_fill = _check_color(new_color)
244248
if self.selected:
245249
self.body.fill = self._selected_fill
@@ -250,7 +254,7 @@ def selected_outline(self) -> Optional[int]:
250254
return self._selected_outline
251255

252256
@selected_outline.setter
253-
def selected_outline(self, new_color: Optional[Union[int, tuple[int, int, int]]]) -> None:
257+
def selected_outline(self, new_color: Union[int, tuple[int, int, int]]) -> None:
254258
self._selected_outline = _check_color(new_color)
255259
if self.selected:
256260
self.body.outline = self._selected_outline

0 commit comments

Comments
 (0)