Spinner#

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()
https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/spinner.gif

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],
    ]
)
https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/spinner-palette.gif

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()
https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/spinner-determinate.gif

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.

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, and determinate_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 a BooleanProperty and defaults to False.

determinate_time#

Determinate time value.

determinate_time is a NumericProperty and defaults to 2.

line_width#

Progress line width of spinner.

line_width is a NumericProperty and defaults to dp(2.25).

active#

Use active to start or stop the spinner.

active is a BooleanProperty and defaults to True.

color#

Spinner color.

color is a ColorProperty and defaults to [0, 0, 0, 0].

palette#

A set of colors. Changes with each completed spinner cycle.

palette is a ListProperty and defaults to [].

on__rotation_angle(self, *args)#
on_palette(self, instance_spinner, palette_list: list)#
on_active(self, instance_spinner, active_value: bool)#
on_determinate_complete(self, *args)#

The event is called at the end of the spinner loop in the determinate = True mode.

check_determinate(self, interval: Union[float, int] = 0)#