In this tutorial, we are going to learn how to create a basic progress bar application with PyQt5 in Python.


Buy Me a Coffee? Your support is much appreciated!
PayPal Me: https://www.paypal.me/jiejenn/5
Venmo: @Jie-Jenn





Python Source Code:

import sys
from PyQt5.QtWidgets import QApplication, QWidget, QProgressBar
from PyQt5.QtCore import QTimer

class AppDemo(QWidget):
    def __init__(self):
        super().__init__()
        self.setWindowTitle('Progress Bar Demo')
        self.resize(500, 100)

        self.progressBar = QProgressBar(self)
        self.progressBar.setGeometry(25, 25, 300, 40)
        self.progressBar.setMaximum(100)
        self.progressBar.setValue(0)

        timer = QTimer(self)
        timer.timeout.connect(self.Increase_Step)
        timer.start(1000)

    def Increase_Step(self):
        self.progressBar.setValue(self.progressBar.value() + 1)

app = QApplication(sys.argv)

demo = AppDemo()
demo.show()

sys.exit(app.exec_())