Behavior
Behaviors allow for expanded functionality for existing widgets
Note
Behaviors can only be used as superclasses for instances of Widget
- class kivycupertino.uix.behavior.CupertinoButtonBehavior(*args: Any, **kwargs: Any)
Base class for buttons that can only be used with an instance of
kivy.uix.widget.Widget
- color
Current color of a widget with
CupertinoButtonBehavior
- color_disabled
Color of widget with
CupertinoButtonBehavior
when disabledPython
CupertinoButton(disabled=True, color_disabled=(0.5, 0, 0, 1))
KV
CupertinoButton: disabled: True color_disabled: 0.5, 0, 0, 1
- color_down
Color of widget with
CupertinoButtonBehavior
when pressedPython
CupertinoButton(color_down=(1, 0, 0, 1))
KV
CupertinoButton: color_down: 1, 0, 0, 1
- color_normal
Color of widget with
CupertinoButtonBehavior
when not pressed or disabledPython
CupertinoButton(color_normal=(1, 0, 0, 1))
KV
CupertinoButton: color_normal: 1, 0, 0, 1
- disabled
If widget with
CupertinoButtonBehavior
is disabledPython
CupertinoButton(disabled=True)
KV
CupertinoButton: disabled: True
- transition_duration = 0.075
Duration of the transition of the color of widget with
CupertinoButtonBehavior
when its state changesPython
CupertinoButton(transition_duration=0.5)
KV
CupertinoButton: transition_duration: 0.5
- class kivycupertino.uix.behavior.LongPressBehavior(**kwargs)
Behavior to detect a long press on a widget
- long_press_duration = 1
Time that constitutes a long press
Python
ExampleWidget(long_press_duration=2)
KV
ExampleWidget: long_press_duration: 2
- on_long_press(touch)
Event when a widget is long pressed
- Parameters
touch – The touch on this widget
- class kivycupertino.uix.behavior.SelectableBehavior(**kwargs)
Behavior to detect a selection of a specific widget among all other widgets in
parent
- on_chosen()
Event when a widget is selected
- on_selected(instance, value)
Callback when
selected
of a widget withSelectableBehavior
is changed- Parameters
instance – Instance of widget with
SelectableBehavior
value – Value of
selected
- refresh()
Set
selected
of this instance ofSelectableBehavior
toTrue
while setting all other instances inparent
toFalse
Note
This function is mainly to be used when adding widgets to a parent. Otherwise, setting
selected
toTrue
will achieve this
- selected = False
If a widget is selected in its
parent
Python
ExampleWidget(selected=True)
KV
ExampleWidget: selected: True