PyQt5 Remove percentage label from QProgressDialog

Viewed 16

I wanted to remove the space that keeps the percentage number in QProgressDialog, when the prograss is indeterminate.

enter image description here

1 Answers

To remove the space, you can create a custom progress bar using QProgressBar widget, and set setTextVisible(False):

dialog = QProgressDialog('Progress', 'Cancel', 0, 0, parent)
bar = QProgressBar(dialog)

# Remove percentage text
bar.setTextVisible(False) 

# Set Indeterminate
bar.setMinimum(0)
bar.setMaximum(0)

# Set progress bar component to dialog
dialog.setBar(bar)

# Show dialog
dialog.show()
Related