PyQt5 Progress Bar and Status Bar Widgets

In this PyQt5 article we want to learn about PyQt5 Progress Bar and Status Bar Widgets, so PyQt5 is Python binding for popular cross-platform GUI toolkit called Qt, Qt was developed by the Qt Company, and it is used for building GUI applications in C++, and PyQt5 provides different GUI widgets and tools, and it allows developers to build nice and good looking interfaces.

 

 

PyQt5 Progress Bar Widget

Progress Bar widget is used to display the progress of a long running task to the user. Using PyQt5 ProgressBar we can create nice visual representation of the completion percentage, and it helps users to understand the status of the ongoing process.

 

let’s create a class that inherits from the QProgressBar class provided by PyQt5. This subclass will encapsulate the progress bar functionality and provides an interface to update the progress.

In the above example, we have created a class called MyProgressBar that inherits from QProgressBar. after that we set the maximum and minimum values for the progress bar using setMaximum() and setMinimum() methods. set_progress() method is defined to update the progress bar with a specific value.

 

 

PyQt5 Status Bar Widget

Status Bar widget is typically located at the bottom of the application window, and it is used to display important messages or status updates. It provides an easy way to communicate with the user without occupying valuable screen real estate. 

In the above example, MyStatusBar class inherits from QStatusBar. after that we define a show_message() method that takes a message as an input and displays it on the status bar using the showMessage() function.

 

 

This is the complete code for this article

 

 

 

Run the complete code and this will be the result

PyQt5 Progress Bar and Status Bar Widgets
PyQt5 Progress Bar and Status Bar Widgets

 

 

Learn More

Leave a Comment