pyqttoast
pyqttoast copied to clipboard
Feature request: progress bar
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)