Book Image

Building Mapping Applications with QGIS

By : Erik Westra
Book Image

Building Mapping Applications with QGIS

By: Erik Westra

Overview of this book

Table of Contents (16 chapters)
Building Mapping Applications with QGIS
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Getting Started with QGIS
Index

Scripting the QGIS user interface


While the example program we created earlier has very limited user interaction, it is quite possible to build your program to directly use the QGIS user interface elements such as the status bar, the message bar, progress indicators, and the QGIS logging window. You can also create custom forms and windows so that the output of your program looks just like any other feature of QGIS itself. Let's take a closer look at how some of these QGIS user-interface elements can be used from within your Python programs.

The status bar

The QGIS window has a status bar. You can use it to display the current status of your Python program, for example:

iface.mainWindow().statusBar().showMessage("Please wait...")

The status message will appear at the bottom of the window, like this:

As you can see, there isn't much room on the status bar, so you'll need to keep your status message short. To hide the message again, do the following:

iface.mainWindow().statusBar().clearMessage(...