32
32
pass
33
33
34
34
class SpriteButton (ButtonBase ):
35
- """Helper class for creating 3x3 Bitmap Spritesheet UI buttons for ``displayio``. Compatible with any format
36
- supported by ''adafruit_imageload''.
35
+ """Helper class for creating 3x3 Bitmap Spritesheet UI buttons for ``displayio``.
36
+ Compatible with any format supported by ''adafruit_imageload''.
37
37
38
38
:param int x: The x position of the button.
39
39
:param int y: The y position of the button.
@@ -42,15 +42,16 @@ class SpriteButton(ButtonBase):
42
42
:param Optional[str] name: A name, or miscellaneous string that is stored on the button.
43
43
:param Optional[str] label: The text that appears inside the button.
44
44
:param Optional[FontProtocol] label_font: The button label font.
45
- :param Optional[Union[int, Tuple[int, int, int]]] label_color: The color of the button label text. Accepts either
46
- an integer or a tuple of 3 integers representing RGB values. Defaults to 0x0.
47
- :param Optional[Union[int, Tuple[int, int, int]]] selected_label: The color of the button label text when the button
48
- is selected. Accepts either an integer or a tuple of 3 integers representing RGB values. Defaults to the inverse of
49
- label_color.
45
+ :param Optional[Union[int, Tuple[int, int, int]]] label_color: The color of the label text.
46
+ Accepts either an integer or a tuple of 3 integers representing RGB values. Defaults to 0x0.
47
+ :param Optional[Union[int, Tuple[int, int, int]]] selected_label: The color of the button label
48
+ text when the button is selected. Accepts either an integer or a tuple of 3 integers
49
+ representing RGB values. Defaults to the inverse of label_color.
50
50
:param str bmp_path: The path of the 3x3 spritesheet mage file
51
- :param Optional[str] selected_bmp_path: The path of the 3x3 spritesheet image file to use when pressed
52
- :param Optional[Union[int, Tuple]] transparent_index: Palette index(s) that will be set to transparent. PNG files have these index(s)
53
- set automatically. Not compatible with JPG files.
51
+ :param Optional[str] selected_bmp_path: The path of the 3x3 spritesheet image file to use when
52
+ pressed
53
+ :param Optional[Union[int, Tuple]] transparent_index: Palette index(s) that will be set to
54
+ transparent. PNG files have these index(s) set automatically. Not compatible with JPG files.
54
55
:param Optional[int] label_scale: The scale multiplier of the button label. Defaults to 1.
55
56
"""
56
57
@@ -64,11 +65,11 @@ def __init__(
64
65
name : Optional [str ] = None ,
65
66
label : Optional [str ] = None ,
66
67
label_font : Optional [FontProtocol ] = None ,
67
- label_color : Optional [Union [int , tuple [int , int , int ]]] = 0x0 ,
68
- selected_label : Optional [Union [int , tuple [int , int , int ]]] = None ,
68
+ label_color : Optional [Union [int , Tuple [int , int , int ]]] = 0x0 ,
69
+ selected_label : Optional [Union [int , Tuple [int , int , int ]]] = None ,
69
70
bmp_path : str = None ,
70
71
selected_bmp_path : Optional [str ] = None ,
71
- transparent_index : Optional [Union [int , tuple ]] = None ,
72
+ transparent_index : Optional [Union [int , Tuple ]] = None ,
72
73
label_scale : Optional [int ] = 1
73
74
):
74
75
if bmp_path is None :
@@ -125,7 +126,7 @@ def height(self) -> int:
125
126
"""The height of the button. Read-Only"""
126
127
return self ._height
127
128
128
- def contains (self , point : list [int ]) -> bool :
129
+ def contains (self , point : List [int ]) -> bool :
129
130
"""Used to determine if a point is contained within a button. For example,
130
131
``button.contains(touch)`` where ``touch`` is the touch point on the screen will allow for
131
132
determining that a button has been touched.
0 commit comments