Beispiel #1
0
# Make the button
button = Button(
    x=BUTTON_X,
    y=BUTTON_Y,
    width=BUTTON_WIDTH,
    height=BUTTON_HEIGHT,
    style=BUTTON_STYLE,
    fill_color=BUTTON_FILL_COLOR,
    outline_color=BUTTON_OUTLINE_COLOR,
    label="HELLO WORLD",
    label_font=terminalio.FONT,
    label_color=BUTTON_LABEL_COLOR,
)

button.fill_color = 0x00FF00
button.outline_color = 0xFF0000

button.selected_fill = (0, 0, 255)
button.selected_outline = (255, 0, 0)

button.label_color = 0xFF0000
button.selected_label = 0x00FF00

# Add button to the display context
splash.append(button)

# Loop and look for touches
while True:
    p = ts.touch_point
    if p:
# initialize the debounced cursor manager
debounced_cursor = DebouncedCursorManager(mouse_cursor)

# create displayio group
splash.append(start_button)
splash.append(select_button)
splash.append(a_button)
splash.append(b_button)
display.show(splash)

while True:
    debounced_cursor.update()

    if debounced_cursor.is_clicked:
        a_button.fill_color = BUTTON_FILL_PURPLE
        print("A pressed:  " + str(debounced_cursor.held))

    if debounced_cursor.released:
        a_button.fill_color = BUTTON_FILL_BLACK
        print("A pressed:  " + str(debounced_cursor.held))

    if debounced_cursor.is_alt_clicked:
        b_button.fill_color = BUTTON_FILL_PURPLE
        print("B pressed:  " + str(debounced_cursor.alt_held))

    if debounced_cursor.alt_released:
        b_button.fill_color = BUTTON_FILL_BLACK
        print("B pressed:  " + str(debounced_cursor.alt_held))

    if debounced_cursor.is_start_clicked: