Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GUI Progress Bar
#3
here's a (minimal) PyQt5 version from the example above

import sys
from PyQt5 import QtGui, QtCore, QtWidgets

class Window(QtWidgets.QMainWindow):

    def __init__(self):
        super(Window, self).__init__()
        self.setGeometry(50, 50, 500, 100)
        self.setWindowTitle("PyQT tuts!")
        self.setWindowIcon(QtGui.QIcon.fromTheme('text-x-python'))

        self.statusBar().showMessage("Ready", 0)

        self.home()

    def home(self):

        self.progress = QtWidgets.QProgressBar(self)
        self.progress.setGeometry(10, 10, 480, 20)

        self.btn = QtWidgets.QPushButton("Download",self)
        self.btn.move(10,40)
        self.btn.clicked.connect(self.download)

        self.show()

    def download(self):
        self.completed = 0

        while self.completed < 100:
            self.completed += 0.0001
            self.progress.setValue(self.completed)
            self.statusBar().showMessage("downloading ...", 0)
            if self.progress.value() == 100:
                self.statusBar().showMessage("completed", 0)
    
def run():
    app = QtWidgets.QApplication(sys.argv)
    GUI = Window()
    sys.exit(app.exec_())

run()
Reply


Messages In This Thread
GUI Progress Bar - by Anysja - Aug-21-2018, 10:54 PM
RE: GUI Progress Bar - by Larz60+ - Aug-22-2018, 02:34 AM
RE: GUI Progress Bar - by Axel_Erfurt - Aug-22-2018, 07:29 AM
RE: GUI Progress Bar - by Anysja - Aug-22-2018, 05:48 PM
RE: GUI Progress Bar - by Axel_Erfurt - Aug-22-2018, 06:18 PM
RE: GUI Progress Bar - by Anysja - Aug-22-2018, 06:54 PM
RE: GUI Progress Bar - by swetanjali - Aug-29-2018, 02:34 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How can I measure progress and display it in the progress bar in the interface? Matgaret 2 6,003 Dec-11-2019, 03:30 PM
Last Post: Denni
  [Tkinter] Progress Bar While Sending an Email maxtimbo 3 4,209 Oct-09-2019, 09:13 PM
Last Post: woooee
  Progress Bar While Sending an Email maxtimbo 0 2,159 Oct-08-2019, 02:13 PM
Last Post: maxtimbo
  [PyQt] cant import progress bar from another py file swipis 7 8,737 Dec-18-2016, 10:41 AM
Last Post: swipis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020