Graphics Reference
In-Depth Information
Any window in QGIS can have its own message bar. The iface variable has a mes-
sageBar() method, which returns the message bar for the main QGIS window, but you
can also add a message bar to your own custom windows if you wish.
To add a message to a message bar, you call the message bar's pushMessage() meth-
od. To create a message without a title, you use the following method signature:
messageBar.pushMessage(text, level=QsgMessageBar.INFO,
duration=None)
For example:
from qgis.gui import *
iface.messageBar().pushMessage("Hello World",
level=QgsMessageBar.INFO)
To include a title, use the following method signature:
messageBar.pushMessage(title, text,
level=QgsMessageBar.INFO, duration=None)
In both cases, the level parameter can be set to QgsMessageBar.INFO , QgsMes-
sageBar.WARNING , or QgsMessageBar.CRITICAL , and if the duration para-
meter is specified, it will be the number of seconds before the message is hidden.
To remove all the messages currently being shown, you can call the mes-
sageBar.clearWidgets() method.
Search WWH ::




Custom Search