In this Python Kivy article we want to talk about How to Create ProgressBar in Python Kivy, so we know that Kivy is an open source GUI framework for Python Programming Language, that you can use it for building multi touch applications for different platforms like desktops, mobile devices and Raspberry Pi, and ProgressBar allows users with a visual representation of progressing of a task.
For creating Kivy ProgressBar, first of all we need to import required modules from kivy.
1 2 |
from kivy.app import App from kivy.uix.progressbar import ProgressBar |
After that we have imported the necessary libraries, we can create a progress bar by instantiating the ProgressBar class.
1 |
progress_bar = ProgressBar(max=100) |
If you want to set value of the progress bar, for that we need to update its value property.
1 |
progress_bar.value = 50 |
Now that we have created our progress bar, we need to add the progressbar to our Kivy app, in this code we have defined a class at name of MyApp that inherits from the App class. after that we override the build() method of the App class, and then we creates a progress_bar with a maximum value of 100 and an initial value of 50.
1 2 3 4 |
class MyApp(App): def build(self): progress_bar = ProgressBar(max=100, value=50) return progress_bar |
For runing our Kivy app, we need to create an instance of our MyApp class and call the run() method.
1 2 |
if __name__ == '__main__': MyApp().run() |
This is the complete code for this article
1 2 3 4 5 6 7 8 9 10 |
from kivy.app import App from kivy.uix.progressbar import ProgressBar class MyApp(App): def build(self): progress_bar = ProgressBar(max=100, value=50) return progress_bar if __name__ == '__main__': MyApp().run() |
Run your code and this is the result

This is another code for Kivy ProgressBar, in this code we have a Button and ProgressBar, by default the value of ProgressBar is zero, and by clicking of the button we are going to update the Kivy ProgressBar.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
from kivy.app import App from kivy.uix.progressbar import ProgressBar from kivy.uix.button import Button from kivy.uix.boxlayout import BoxLayout class MyApp(App): def build(self): self.progress_bar = ProgressBar(max=100, value=0) button = Button(text='Click to Update', size_hint=(0.5, 0.5)) button.bind(on_press=self.do_task) layout = BoxLayout(orientation='vertical') layout.add_widget(self.progress_bar) layout.add_widget(button) return layout def do_task(self, instance): for i in range(1, 11): self.progress_bar.value = i * 10 if __name__ == '__main__': MyApp().run() |
Run the code and click on the button, it will update ProgressBar value.
