3232 pass
3333
3434class 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''.
3737
3838 :param int x: The x position of the button.
3939 :param int y: The y position of the button.
@@ -42,15 +42,16 @@ class SpriteButton(ButtonBase):
4242 :param Optional[str] name: A name, or miscellaneous string that is stored on the button.
4343 :param Optional[str] label: The text that appears inside the button.
4444 :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.
5050 :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.
5455 :param Optional[int] label_scale: The scale multiplier of the button label. Defaults to 1.
5556 """
5657
@@ -64,11 +65,11 @@ def __init__(
6465 name : Optional [str ] = None ,
6566 label : Optional [str ] = None ,
6667 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 ,
6970 bmp_path : str = None ,
7071 selected_bmp_path : Optional [str ] = None ,
71- transparent_index : Optional [Union [int , tuple ]] = None ,
72+ transparent_index : Optional [Union [int , Tuple ]] = None ,
7273 label_scale : Optional [int ] = 1
7374 ):
7475 if bmp_path is None :
@@ -125,7 +126,7 @@ def height(self) -> int:
125126 """The height of the button. Read-Only"""
126127 return self ._height
127128
128- def contains (self , point : list [int ]) -> bool :
129+ def contains (self , point : List [int ]) -> bool :
129130 """Used to determine if a point is contained within a button. For example,
130131 ``button.contains(touch)`` where ``touch`` is the touch point on the screen will allow for
131132 determining that a button has been touched.
0 commit comments