ProgressIndicator#
#
Progress indicators show the status of a process in real time.
Use the same progress indicator for all instances of a process (like loading)
Two types: linear and circular
Never use them as decoration
They capture attention through motion
Linear progress indicator
Circular progress indicator
Usage#
from kivy.lang import Builder
from kivymd.app import MDApp
KV = '''
MDScreen:
md_bg_color: self.theme_cls.backgroundColor
MDLinearProgressIndicator:
size_hint_x: .5
value: 50
pos_hint: {'center_x': .5, 'center_y': .5}
'''
class Example(MDApp):
def build(self):
self.theme_cls.theme_style = "Dark"
return Builder.load_string(KV)
Example().run()
from kivymd.app import MDApp
from kivymd.uix.progressindicator import MDLinearProgressIndicator
from kivymd.uix.screen import MDScreen
class Example(MDApp):
def build(self):
self.theme_cls.theme_style = "Dark"
return (
MDScreen(
MDLinearProgressIndicator(
size_hint_x=.5,
value=50,
pos_hint={'center_x': .5, 'center_y': .5},
),
md_bg_color=self.theme_cls.backgroundColor
)
)
Example().run()
from kivy.lang import Builder
from kivymd.app import MDApp
KV = '''
MDScreen:
md_bg_color: self.theme_cls.backgroundColor
MDCircularProgressIndicator:
size_hint: None, None
size: "48dp", "48dp"
pos_hint: {'center_x': .5, 'center_y': .5}
'''
class Example(MDApp):
def build(self):
self.theme_cls.theme_style = "Dark"
return Builder.load_string(KV)
Example().run()
from kivymd.app import MDApp
from kivymd.uix.progressindicator import MDCircularProgressIndicator
from kivymd.uix.screen import MDScreen
class Example(MDApp):
def build(self):
self.theme_cls.theme_style = "Dark"
return (
MDScreen(
MDCircularProgressIndicator(
size_hint=(None, None),
size=("48dp", "48dp"),
pos_hint={'center_x': .5, 'center_y': .5},
),
md_bg_color=self.theme_cls.backgroundColor
)
)
Example().run()
Linear progress indicators can be determinate or indeterminate.
Determinate linear progress indicator#
Determinate operations display the indicator increasing from 0 to 100% of the track, in sync with the process’s progress.
from kivy.lang import Builder
from kivymd.app import MDApp
KV = '''
MDScreen:
md_bg_color: self.theme_cls.backgroundColor
MDLinearProgressIndicator:
id: progress
size_hint_x: .5
type: "determinate"
pos_hint: {'center_x': .5, 'center_y': .4}
'''
class Example(MDApp):
def on_start(self):
self.root.ids.progress.start()
def build(self):
self.theme_cls.theme_style = "Dark"
return Builder.load_string(KV)
Example().run()
from kivymd.app import MDApp
from kivymd.uix.progressindicator import MDLinearProgressIndicator
from kivymd.uix.screen import MDScreen
class Example(MDApp):
def on_start(self):
self.root.get_ids().progress.start()
def build(self):
self.theme_cls.theme_style = "Dark"
return (
MDScreen(
MDLinearProgressIndicator(
id="progress",
type="determinate",
size_hint_x=.5,
value=50,
pos_hint={'center_x': .5, 'center_y': .5},
),
md_bg_color=self.theme_cls.backgroundColor
)
)
Example().run()
Circular progress indicators can be determinate or indeterminate.
Indeterminate circular progress indicator#
Indeterminate operations display the indicator continually growing and shrinking along the track until the process is complete..
MDCircularProgressIndicator:
size_hint: None, None
size: "48dp", "48dp"
MDCircularProgressIndicator(
size_hint=(None, None),
size=("48dp", "48dp"),
)
Determinate circular progress indicator#
MDCircularProgressIndicator:
size_hint: None, None
size: "48dp", "48dp"
determinate: True
on_determinate_complete: print(args)
MDCircularProgressIndicator(
determinate=True,
size_hint=(None, None),
size=("48dp", "48dp"),
on_determinate_complete=lambda *args: print(args),
)
API break#
1.1.1 version#
MDProgressBar:
value: 50
color: app.theme_cls.accent_color
MDSpinner:
size_hint: None, None
size: dp(48), dp(48)
2.0.0 version#
MDLinearProgressIndicator:
value: 50
indicator_color: app.theme_cls.errorColor
MDLinearProgressIndicator(
value=50,
indicator_color=self.theme_cls.errorColor,
)
MDCircularProgressIndicator:
size_hint: None, None
size: dp(48), dp(48)
MDCircularProgressIndicator(
size_hint=(None, None),
size=("48dp", "48dp"),
)
API - kivymd.uix.progressindicator.progressindicator#
- class kivymd.uix.progressindicator.progressindicator.MDLinearProgressIndicator(**kwargs)#
Implementation of the linear progress indicator.
For more information, see in the
DeclarativeBehaviorandThemableBehaviorandProgressBarclasses documentation.- radius#
Progress line radius.
Added in version 1.2.0.
radiusis anVariableListPropertyand defaults to [0, 0, 0, 0].
- reversed#
Reverse the direction the progressbar moves.
reversedis anBooleanPropertyand defaults to False.
- orientation#
Orientation of progressbar. Available options are: ‘horizontal ‘, ‘vertical’.
orientationis anOptionPropertyand defaults to ‘horizontal’.
- indicator_color#
Color of the active track.
Changed in version 2.0.0: Rename from color to indicator_color attribute.
indicator_coloris anColorPropertyand defaults to None.
- track_color#
Progress bar back color in (r, g, b, a) or string format.
Added in version 1.0.0.
Changed in version 2.0.0: Rename from back_color to track_color attribute.
track_coloris anColorPropertyand defaults to None.
- running_determinate_transition#
Running transition.
Changed in version 2.0.0: Rename from running_transition to running_determinate_transition attribute.
running_determinate_transitionis anStringPropertyand defaults to ‘out_quart’.
- catching_determinate_transition#
Catching transition.
Changed in version 2.0.0: Rename from catching_transition to catching_determinate_transition attribute.
catching_determinate_transitionis anStringPropertyand defaults to ‘out_quart’.
- running_determinate_duration#
Running duration.
Changed in version 2.0.0: Rename from running_duration to running_determinate_duration attribute.
running_determinate_durationis anNumericPropertyand defaults to 2.5.
- catching_determinate_duration#
Catching duration.
running_durationis anNumericPropertyand defaults to 0.8.
- type#
Type of progressbar. Available options are: ‘indeterminate ‘, ‘determinate’.
typeis anOptionPropertyand defaults to None.
- running_indeterminate_transition#
Running transition.
running_indeterminate_transitionis anStringPropertyand defaults to ‘in_cubic’.
- catching_indeterminate_transition#
Catching transition.
catching_indeterminate_transitionis anStringPropertyand defaults to ‘out_quart’.
- running_indeterminate_duration#
Running duration.
running_indeterminate_durationis anNumericPropertyand defaults to 0.5.
- catching_indeterminate_duration#
Catching duration.
catching_indeterminate_durationis anNumericPropertyand defaults to 0.8.
- on_value(instance, value)#
- class kivymd.uix.progressindicator.progressindicator.MDCircularProgressIndicator(**kwargs)#
Implementation of the circular progress indicator.
Changed in version 2.0.0: Rename MDSpinner to MDCircularProgressIndicator class.
For more information, see in the
ThemableBehaviorandWidgetclasses 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
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 indicator 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 indicator.
line_widthis aNumericPropertyand defaults to dp(2.25).
- active#
Use
activeto start or stop the indicator.activeis aBooleanPropertyand defaults to True.
- color#
Indicator color in (r, g, b, a) or string format.
coloris aColorPropertyand defaults to None.
- palette#
A set of colors. Changes with each completed indicator cycle.
paletteis aListPropertyand defaults to [].
- on__rotation_angle(*args)#