Spinner#
See also Circular progress indicator in Google’s Material Design.Usage#
from kivy.lang import Builder
from kivymd.app import MDApp
KV = '''
MDScreen:
MDSpinner:
size_hint: None, None
size: dp(46), dp(46)
pos_hint: {'center_x': .5, 'center_y': .5}
active: True if check.active else False
MDCheckbox:
id: check
size_hint: None, None
size: dp(48), dp(48)
pos_hint: {'center_x': .5, 'center_y': .4}
active: True
'''
class Test(MDApp):
def build(self):
return Builder.load_string(KV)
Test().run()
Spinner palette#
MDSpinner:
# The number of color values can be any.
palette:
[0.28627450980392155, 0.8431372549019608, 0.596078431372549, 1], [0.3568627450980392, 0.3215686274509804, 0.8666666666666667, 1], [0.8862745098039215, 0.36470588235294116, 0.592156862745098, 1], [0.8784313725490196, 0.9058823529411765, 0.40784313725490196, 1],
MDSpinner(
size_hint=(None, None),
size=(dp(46), dp(46)),
pos_hint={'center_x': .5, 'center_y': .5},
active=True,
palette=[
[0.28627450980392155, 0.8431372549019608, 0.596078431372549, 1],
[0.3568627450980392, 0.3215686274509804, 0.8666666666666667, 1],
[0.8862745098039215, 0.36470588235294116, 0.592156862745098, 1],
[0.8784313725490196, 0.9058823529411765, 0.40784313725490196, 1],
]
)
Determinate mode#
from kivy.lang import Builder
from kivymd.app import MDApp
KV = '''
MDScreen:
MDSpinner:
size_hint: None, None
size: dp(48), dp(48)
pos_hint: {'center_x': .5, 'center_y': .5}
determinate: True
'''
class Test(MDApp):
def build(self):
return Builder.load_string(KV)
Test().run()
API - kivymd.uix.spinner.spinner#
- class kivymd.uix.spinner.spinner.MDSpinner(**kwargs)#
MDSpinneris an implementation of the circular progress indicator in Google’s Material Design.It can be used either as an indeterminate indicator that loops while the user waits for something to happen, or as a determinate indicator.
Set
determinateto True to activate determinate mode, anddeterminate_timeto set the duration of the animation.- Events:
- on_determinate_complete
The event is called at the end of the spinner loop in the determinate = True mode.
- determinate#
Determinate value.
determinateis aBooleanPropertyand defaults to False.
- determinate_time#
Determinate time value.
determinate_timeis aNumericPropertyand defaults to 2.
- line_width#
Progress line width of spinner.
line_widthis aNumericPropertyand defaults to dp(2.25).
- active#
Use
activeto start or stop the spinner.activeis aBooleanPropertyand defaults to True.
- color#
Spinner color.
coloris aColorPropertyand defaults to [0, 0, 0, 0].
- palette#
A set of colors. Changes with each completed spinner cycle.
paletteis aListPropertyand defaults to [].
- on__rotation_angle(self, *args)#
- on_determinate_complete(self, *args)#
The event is called at the end of the spinner loop in the determinate = True mode.