Pushing messages to the message bar
The QGIS message bar provides an unobtrusive way to display messages to the user. It displays on the top of the map window on a timer, so it automatically goes away without any required interaction from the user. In this recipe, we'll push a simple message to the status bar.
Getting ready
Open the QGIS Python console by selecting the Plugins menu and then clicking on Python Console.
How to do it...
This recipe is a simple one-liner because using the message bar is really easy. We just call the message bar API with a header text message, which will be displayed in bold and another message, which will be displayed without any formatting.
All we do is push two strings to the message bar. The first string will be displayed in bold:
iface.messageBar().pushInfo(u'Time is running out', u'Read this quickly!')
How it works...
The message bar lasts for about five seconds and has a button to pause the timer if needed. The message bar is now...