Progress Bar Widget in Kivy (original) (raw)

Last Updated : 8 Oct, 2025

A ProgressBar in Kivy is a display-only widget used to visualize the progress of a task. It currently supports only horizontal mode. The progress can be updated programmatically by changing the value property. Let's add a simple Progress Bar to a Kivy window.

Below program adds a horizontal progress bar to the Kivy window and sets a value to show progress.

Python `

from kivy.app import App from kivy.uix.progressbar import ProgressBar from kivy.uix.widget import Widget from kivy.core.window import Window

Window.clearcolor = (1, 1, 1, 1)

class BasicProgressBar(Widget): def init(self, **kwargs): super().init(**kwargs) cx = Window.width / 2 self.pb = ProgressBar(max=100, value=50, size_hint=(None, None), width=300, height=30,pos=(cx - 150, Window.height - 100)) self.add_widget(self.pb)

class ProgressBarApp(App): def build(self): return BasicProgressBar()

if name == 'main': ProgressBarApp().run()

`

**Output

BasicProgressBarOutput

**Explanation:

Syntax

ProgressBar(max=100, value=0, size_hint=(None,None), width=200, height=30)

**Parameters:

Examples

**Example 1: This program adds a button. Clicking it opens a popup containing a progress bar, which fills over time.

Python `

Window.clearcolor = (0.98, 0.98, 1, 1)

class ProgressButton(Widget): def init(self, **kwargs): super().init(**kwargs) self.pb = ProgressBar(max=100, value=0, size_hint=(1, None), height=30) self.popup = Popup(title='Download', content=self.pb, size_hint=(0.5, 0.2)) self.popup.bind(on_open=self.start_progress) btn = Button(text='Start Download', size_hint=(None,None), width=150, height=40,pos=(Window.width/2 - 75, Window.height - 100), on_release=self.show_popup) self.add_widget(btn)

def show_popup(self, instance):
    self.pb.value = 0
    self.popup.open()

def start_progress(self, instance):
    Clock.schedule_interval(self.update_progress, 1/25)

def update_progress(self, dt):
    if self.pb.value >= 100:
        return False
    self.pb.value += 1

class ProgressBarApp(App): def build(self): return ProgressButton()

if name == 'main': ProgressBarApp().run()

`

**Output

ProgressBarEx1Output

**Explanation:

**Example 2: This code shows a progress bar in the main window, updating automatically using Clock.

Python `

Window.clearcolor = (1, 1, 0.95, 1)

class AutoProgress(Widget): def init(self, **kwargs): super().init(**kwargs) cx = Window.width / 2 self.pb = ProgressBar(max=100, value=0, size_hint=(None,None), width=300, height=30,pos=(cx - 150, Window.height - 120)) self.add_widget(self.pb) Clock.schedule_interval(self.update_progress, 1/20)

def update_progress(self, dt):
    if self.pb.value < 100:
        self.pb.value += 1

class ProgressBarApp(App): def build(self): return AutoProgress()

if name == 'main': ProgressBarApp().run()

`

**Output

ProgressBarEx2Output

**Explanation: