PySide2extn icon indicating copy to clipboard operation
PySide2extn copied to clipboard

Implement round progress bar with Qtimer?

Open samannazz opened this issue 3 years ago • 0 comments

I have edit your code to meet my goal. I want to implement a progress bar with timer like... if I pressed start button... timer should initialize itself and after every 10 minutes the progress bar progresses itself by 10%. after timer resets itself after 90 minutes.
For that i have set the timer.start(10 minutes), and progress_val(90 minutes).
problem: problem is that after 1st 10 minutes progress bar increases and for next 10 minutes the next dotted line increases by adding to first dot line. what i want is the one dot line should represent the 10 minutes and for next 10 minutes the next dot line draw, and there should be distance between them.

    # LETS ADD TIMER TO CHANGE PROGRESSES
    self.timer = QtCore.QTimer()
    self.timer.timeout.connect(self.progress)  # progress function
    self.timer.start(60000)  # every 1 minute = 60000ms

    # Change all progresses to zero on start
    QtCore.QTimer.singleShot(0, lambda: self.ui.progressBar.rpb_setValue(0))

def progress(self):
    global progress_val
    # Set progress values
    self.ui.progressBar.rpb_setValue(progress_val)

    # Reset progresses if the maximum value is reached
    if progress_val > 5400000:  # value update till 90 minutes
        progress_val = 0

    # Increase value every 60 ms
    progress_val += 1

`

samannazz avatar Apr 07 '22 09:04 samannazz