adafruit_button

UI Buttons for displayio

  • Author(s): Limor Fried

Implementation Notes

Software and Dependencies:

adafruit_button.button

UI Buttons for displayio

  • Author(s): Limor Fried

Implementation Notes

Software and Dependencies:

class adafruit_button.button_base.ButtonBase(*args: Any, **kwargs: Any)

Superclass for creating UI buttons for displayio.

Parameters:
  • x – The x position of the button.

  • y – The y position of the button.

  • width – The width of the button in tiles.

  • height – The height of the button in tiles.

  • name – A name, or miscellaneous string that is stored on the button.

  • label – The text that appears inside the button. Defaults to not displaying the label.

  • label_font – The button label font.

  • label_color – The color of the button label text. Defaults to 0x0.

  • selected_label – Text that appears when selected

property label

The text label of the button

property label_color

The font color of the button

property selected

Selected inverts the colors.

property selected_label

The font color of the button when selected

adafruit_button.button

UI Buttons for displayio

  • Author(s): Limor Fried

Implementation Notes

Software and Dependencies:

class adafruit_button.button.Button(*args: Any, **kwargs: Any)

Helper class for creating UI buttons for displayio.

Parameters:
  • x – The x position of the button.

  • y – The y position of the button.

  • width – The width of the button in pixels.

  • height – The height of the button in pixels.

  • name – The name of the button.

  • style – The style of the button. Can be RECT, ROUNDRECT, SHADOWRECT, SHADOWROUNDRECT. Defaults to RECT.

  • fill_color – The color to fill the button. Defaults to 0xFFFFFF.

  • outline_color – The color of the outline of the button.

  • label – The text that appears inside the button. Defaults to not displaying the label.

  • label_font – The button label font.

  • label_color – The color of the button label text. Defaults to 0x0.

  • selected_fill – Inverts the fill color.

  • selected_outline – Inverts the outline color.

  • selected_label – Inverts the label color.

contains(point)

Used to determine if a point is contained within a button. For example, button.contains(touch) where touch is the touch point on the screen will allow for determining that a button has been touched.

property fill_color

The fill color of the button body

property group

Return self for compatibility with old API.

property height

The height of the button

property outline_color

The outline color of the button body

resize(new_width, new_height)

Resize the button to the new width and height given :param new_width int the desired width :param new_height int the desired height

property selected_fill

The fill color of the button body when selected

property selected_outline

The outline color of the button body when selected

property width

The width of the button