Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Implement round progress bar with Qtimer? #3

Open
samannazz opened this issue Apr 7, 2022 · 0 comments
Open

Implement round progress bar with Qtimer? #3

samannazz opened this issue Apr 7, 2022 · 0 comments

Comments

@samannazz
Copy link

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

`

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant