- class adafruit_button.button_base.ButtonBase(*args: Any, **kwargs: Any)
Superclass for creating UI buttons for
displayio
.- Parameters:
x (int) – The x position of the button.
y (int) – The y position of the button.
width (int) – The width of the button in tiles.
height (int) – The height of the button in tiles.
name (Optional[str]) – A name, or miscellaneous string that is stored on the button.
label (Optional[str]) – The text that appears inside the button.
label_font (Optional[FontProtocol]) – The button label font. Defaults to ‘’terminalio.FONT’’
label_color (Optional[Union[int, Tuple[int, int, int]]]) – The color of the label text. Defaults to 0x0. Accepts an int or a tuple of 3 integers representing RGB values.
selected_label (Optional[Union[int, Tuple[int, int, int]]]) – The color of the label text when the button is selected. Accepts an int or a tuple of 3 integers representing RGB values. Defaults to an inverse of label_color.
label_scale (Optional[int]) – The scale factor used for the label. Defaults to 1.
- class adafruit_button.button.Button(*args: Any, **kwargs: Any)
Helper class for creating UI buttons for
displayio
. Provides the following buttons: RECT: A rectangular button. SHAWDOWRECT adds a drop shadow. ROUNDRECT: A rectangular button with rounded corners. SHADOWROUNDRECT adds a drop shadow.- Parameters:
x (int) – The x position of the button.
y (int) – The y position of the button.
width (int) – The width of the button in pixels.
height (int) – The height of the button in pixels.
name (Optional[str]) – The name of the button.
style – The style of the button. Can be RECT, ROUNDRECT, SHADOWRECT, SHADOWROUNDRECT. Defaults to RECT.
fill_color (Optional[Union[int, Tuple[int, int, int]]]) – The color to fill the button. Accepts an int or a tuple of 3 integers representing RGB values. Defaults to 0xFFFFFF.
outline_color (Optional[Union[int, Tuple[int, int, int]]]) – The color of the outline of the button. Accepts an int or a tuple of 3 integers representing RGB values. Defaults to 0x0.
label (Optional[str]) – The text that appears inside the button.
label_font (Optional[FontProtocol]) – The button label font. Defaults to ‘’terminalio.FONT’’
label_color (Optional[Union[int, Tuple[int, int, int]]]) – The color of the button label text. Accepts an int or a tuple of 3 integers representing RGB values. Defaults to 0x0.
selected_fill (Optional[Union[int, Tuple[int, int, int]]]) – The fill color when the button is selected. Accepts an int or a tuple of 3 integers representing RGB values. Defaults to the inverse of the fill_color.
selected_outline (Optional[Union[int, Tuple[int, int, int]]]) – The outline color when the button is selected. Accepts an int or a tuple of 3 integers representing RGB values. Defaults to the inverse of outline_color.
selected_label (Optional[Union[int, Tuple[int, int, int]]]) – The label color when the button is selected. Accepts an int or a tuple of 3 integers representing RGB values. Defaults to inverting the label_color.
label_scale (Optional[int]) – The scale factor used for the label. Defaults to 1.
- property group: displayio.Group
Return self for compatibility with old API.