Displaying a progress bar

A progress bar is a dynamic dialog that displays the percentage of completion bar for a running process that the user must wait for before continuing. A progress bar is more advanced than a simple dialog, because it needs to be updated continuously. In this recipe, we'll create a simple progress dialog based on a timer.

Getting ready

Open the QGIS Python console by selecting the Plugins menu and then clicking on Python Console.

How to do it...

The steps for this recipe include creating a custom class based on the QProgressBar, initializing the dialog and setting its size and title, creating a timer, connecting the progress bar to the timer, starting the time, and displaying the progress. To do this, we need to perform the ...

Get QGIS Python Programming Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.