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)#
MDSpinner
is an implementation of the circular progress indicator in Google’s Material Design.For more information, see in the
ThemableBehavior
andWidget
classes documentation.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
determinate
to True to activate determinate mode, anddeterminate_time
to 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.
determinate
is aBooleanProperty
and defaults to False.
- determinate_time#
Determinate time value.
determinate_time
is aNumericProperty
and defaults to 2.
- line_width#
Progress line width of spinner.
line_width
is aNumericProperty
and defaults to dp(2.25).
- active#
Use
active
to start or stop the spinner.active
is aBooleanProperty
and defaults to True.
- color#
Spinner color in (r, g, b, a) or string format.
color
is aColorProperty
and defaults to [0, 0, 0, 0].
- palette#
A set of colors. Changes with each completed spinner cycle.
palette
is aListProperty
and 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.