ProgressBar#
Progress indicators express an unspecified wait time or display
the length of a process. KivyMD provides the following bars classes for use:
MDProgressBar#
from kivy.lang import Builder
from kivymd.app import MDApp
KV = '''
MDBoxLayout:
padding: "10dp"
MDProgressBar:
value: 50
'''
class Test(MDApp):
def build(self):
return Builder.load_string(KV)
Test().run()
Vertical orientation#
MDProgressBar:
orientation: "vertical"
value: 50
With custom color#
MDProgressBar:
value: 50
color: app.theme_cls.accent_color
Indeterminate#
from kivy.lang import Builder
from kivy.properties import StringProperty
from kivymd.app import MDApp
KV = '''
MDScreen:
MDProgressBar:
id: progress
pos_hint: {"center_y": .6}
type: "indeterminate"
MDRaisedButton:
text: "STOP" if app.state == "start" else "START"
pos_hint: {"center_x": .5, "center_y": .45}
on_press: app.state = "stop" if app.state == "start" else "start"
'''
class Test(MDApp):
state = StringProperty("stop")
def build(self):
return Builder.load_string(KV)
def on_state(self, instance, value):
{
"start": self.root.ids.progress.start,
"stop": self.root.ids.progress.stop,
}.get(value)()
Test().run()
Determinate#
MDProgressBar:
type: "determinate"
running_duration: 1
catching_duration: 1.5
API - kivymd.uix.progressbar.progressbar
#
- class kivymd.uix.progressbar.progressbar.MDProgressBar(**kwargs)#
Progressbar class.
For more information, see in the
ThemableBehavior
andProgressBar
classes documentation.- radius#
Progress line radius.
New in version 1.2.0.
radius
is anVariableListProperty
and defaults to [0, 0, 0, 0].
- reversed#
Reverse the direction the progressbar moves.
reversed
is anBooleanProperty
and defaults to False.
- orientation#
Orientation of progressbar. Available options are: ‘horizontal ‘, ‘vertical’.
orientation
is anOptionProperty
and defaults to ‘horizontal’.
- color#
Progress bar color in (r, g, b, a) or string format.
color
is anColorProperty
and defaults to None.
- back_color#
Progress bar back color in (r, g, b, a) or string format.
New in version 1.0.0.
back_color
is anColorProperty
and defaults to None.
- running_transition#
Running transition.
running_transition
is anStringProperty
and defaults to ‘in_cubic’.
- catching_transition#
Catching transition.
catching_transition
is anStringProperty
and defaults to ‘out_quart’.
- running_duration#
Running duration.
running_duration
is anNumericProperty
and defaults to 0.5.
- catching_duration#
Catching duration.
running_duration
is anNumericProperty
and defaults to 0.8.
- type#
Type of progressbar. Available options are: ‘indeterminate ‘, ‘determinate’.
type
is anOptionProperty
and defaults to None.
- start(self)#
Start animation.
- stop(self)#
Stop animation.
- running_away(self, *args)#
- catching_up(self, *args)#