Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Feature request: progress bar #11

Open
abrichr opened this issue May 9, 2024 · 0 comments
Open

Feature request: progress bar #11

abrichr opened this issue May 9, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@abrichr
Copy link

abrichr commented May 9, 2024

It would be great to be able to display progress in a pyqttoast widget, e.g. similar to tqdm in the terminal.

It appears that most of the functionality is already implemented in the form of the duration bar.

Edit: it looks like Qt has a QProgressBar that could also be useful here.

Maybe something like:

self.progress_bar = QProgressBar(self)
self.progress_bar.setRange(0, 100)  # Set the range from 0 to 100
self.progress_bar.setValue(0)       # Initialize with 0 progress
self.progress_bar.setTextVisible(True)  # Show text inside the progress bar
self.progress_bar.setStyleSheet("""
    QProgressBar {
        border: 2px solid grey;
        border-radius: 5px;
        text-align: center;
    }
    QProgressBar::chunk {
        background-color: #05B8CC;
        width: 20px;
    }
""")  # Styling the progress bar

...

self.progress_bar.setGeometry(10, 70, 280, 20)  # Adjust size and position accordingly

...

def update_progress(self, value: int):
    """Update the progress bar with a new value.

    :param value: int, the new progress value to set.
    """
    self.progress_bar.setValue(value)

def show_progress_bar(self, show: bool):
    """Control the visibility of the progress bar.

    :param show: bool, True to show the progress bar, False to hide.
    """
    self.progress_bar.setVisible(show)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants