displayio_flipinput
¶
A flip style input selector.
Author(s): Kevin Matocha
Implementation Notes¶
Hardware:
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
- class displayio_flipinput.FlipInput(display, *, value_list=None, font=<fontio.BuiltinFont object>, font_scale=1, color=16777215, value=0, arrow_touch_padding=0, arrow_color=3355443, arrow_outline=5592405, arrow_height=30, arrow_width=30, arrow_gap=5, alt_touch_padding=0, horizontal=True, animation_time=None, cool_down=0.0, **kwargs)¶
A flip style input selector. The value changes based on touch inputs on the two halves of the indicator with optional arrows added.
- Parameters
x (int) – pixel position
y (int) – pixel position
display (displayio.Display) – the display where the widget will be displayed
value_list (List[str]) – the list of strings that will be displayed
font (Font) – the font used for the text (defaults to
terminalio.FONT
)font_scale (int) – the scaling of the font in integer values (default is 1)
color (int) – the color used for the font (default is 0xFFFFFF)
value (int) – the index into the value_list that is initially displayed (default is 0)
arrow_color (int) – the color used for the arrow fill (default is 0x333333)
arrow_outline (int) – the color used for the arrow outline (default is 0x555555)
arrow_height (int) – the height of the arrows, in pixels (default is 30 pixels)
arrow_width (int) – the width of the arrows, in pixels (default is 30 pixels)
arrow_gap (int) – distance from text to the arrow, in pixels (default is 5), can also be a negative value
arrow_touch_padding (int) – additional padding on the arrow sides of the widget where touch response is accepted, in pixels (default = 0)
alt_touch_padding (int) – additional padding on the non-arrow sides of the widget where touch response is accepted, in pixels (default = 0)
horizontal (Boolean) – set to
True
to display arrows are in the horizontal direction, setFalse
for arrows in the vertical direction (default =True
)animation_time (float) – duration for the animation during flipping between values, in seconds (default is 0.4 seconds), set to 0.0 or
None
for no animation.cool_down (float) – minimum duration between activations of the widget with a continuous pressing, this can be used to reduce the chance of accidental multiple activations, in seconds (default is 0.0 seconds, no delay). Set to -1.0 to require the button be released and pressed again for activation (Note: This requires calling the
released
function prior to the next call toselected
.)
Create a Group of a given size and scale. Scale is in one dimension. For example, scale=2 leads to a layer’s pixel being 2x2 pixels when in the group.
- contains(touch_point)¶
Returns True if the touch_point is within the widget’s touch_boundary.
- released()¶
Response function when the Control is released. Resets the state variables for handling situation when
cool_down
is < 0 that requiresreleased()
before reacting another anotherselected()
.
- selected(touch_point)¶
Response function when the Control is selected. Increases value when upper half is pressed and decreases value when lower half is pressed.