Hello, I will explain the progressbar topic. You can guess where it is used.for example, when you download a file from the internet, you want to see what % , or when you copy a file from one place to another, it appears when you copy it.
It can be used in almost all of the process processes.
Example :
progressbar object
self.progress_bar = QProgressBar(self)
While setting new value to the progressbar object
self.progress_bar.setValue(startVal)
Result :
Full Source Code:
from PyQt5 import QtWidgets from PyQt5.QtWidgets import * import sys import time W_WIDTH = 260 W_HEIGHT = 150 W_X = 725 W_Y = 350 class CreateButton: def __init__(self, window, text, width, height, x, y): self.button = QtWidgets.QPushButton(window) self.button.setText(text) self.button.resize(width, height) self.button.move(x, y) def get_instance(self): return self.button class MainFrame(QMainWindow): def __init__(self): super(MainFrame, self).__init__() self.init() self.show() def init(self): self.resize(W_WIDTH, W_HEIGHT) self.move(W_X, W_Y) self.setWindowTitle("www.langpy.com | Python GUI Tutorial") self.progress_bar = QProgressBar(self) self.progress_bar.setGeometry(5,5,250,25) self.start_button = CreateButton(self, "Start Button", 105, 25, 5, 35).get_instance() self.start_button.clicked.connect(self.startprogressbar) def startprogressbar(self): for startVal in range(1,101): time.sleep(0.07) self.progress_bar.setValue(startVal) # print(start) app = QApplication(sys.argv) win = MainFrame() sys.exit(app.exec_())