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
CupertinoButtonBehaviorwhen disabled
Python
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
CupertinoButtonBehaviorwhen pressed
Python
CupertinoButton(color_down=(1, 0, 0, 1))
KV
CupertinoButton: color_down: 1, 0, 0, 1
- color_normal
Color of widget with
CupertinoButtonBehaviorwhen not pressed or disabled
Python
CupertinoButton(color_normal=(1, 0, 0, 1))
KV
CupertinoButton: color_normal: 1, 0, 0, 1
- disabled
If widget with
CupertinoButtonBehavioris disabled
Python
CupertinoButton(disabled=True)
KV
CupertinoButton: disabled: True
- transition_duration = 0.075
Duration of the transition of the color of widget with
CupertinoButtonBehaviorwhen its state changes
Python
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
selectedof a widget withSelectableBehavioris changed- Parameters
instance – Instance of widget with
SelectableBehaviorvalue – Value of
selected
- refresh()
Set
selectedof this instance ofSelectableBehaviortoTruewhile setting all other instances inparenttoFalseNote
This function is mainly to be used when adding widgets to a parent. Otherwise, setting
selectedtoTruewill achieve this
- selected = False
If a widget is selected in its
parent
Python
ExampleWidget(selected=True)
KV
ExampleWidget: selected: True