Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Is there any way to show our custom message in Qgis Status bar using python? Just like in arcgis "IApplication.statusbar.message(0) = "Please wait..."

like that is there any option to show progressbar in Qgis like "IApplication.progressbar.show()"

share|improve this question

1 Answer 1

up vote 12 down vote accepted

StatusBar

You can use iface.mainWindow().statusBar() which returns a QStatusBar

iface.mainWindow().statusBar().showMessage( u"Hello World" )

In the python console for QGIS < 1.9 it would be:

qgis.utils.iface.mainWindow().statusBar().showMessage( u"Hello World" )

MessageBar

Starting from QGIS 2.0 there is also QgsMessageBar which is able to display unobtrusive messages or any QWidget (like a QProgressBar) with a close button and a timeout ( 5 seconds in the example ).

from PyQt4.QtGui import QProgressBar
from qgis.gui import QgsMessageBar
msgBar = iface.messageBar()

pb = QProgressBar( msgBar )
msgBar.pushWidget( pb, QgsMessageBar.INFO, 5 )

msg = msgBar.createMessage( u'Hello World' )
msgBar.pushWidget( msg, QgsMessageBar.WARNING, 5 )

More info about QgsMessageBar can be found in this answer by NathanW How to adress the new "Task-Completed" bar in python? Thanks for pointing out Curlew

share|improve this answer
    
Thanks a lot Matthias..is there any option for progressbar? –  venkat Apr 22 '13 at 11:33
    
In the QgsMessageBar you're able to display any kind of widget. I would not know that this is possible in the status bar. –  Matthias Kuhn Apr 22 '13 at 11:36
    
I am very new to qgis and python.. could you please give me example for QgsMessageBar? and what is the meaning of using 'u' prefix in "Hello world" –  venkat Apr 22 '13 at 11:40
3  
Also see Nathans answer on how to push a widget to the new messagebar gis.stackexchange.com/questions/57067/… –  Curlew Apr 22 '13 at 13:32
2  
@venkat, If you think this was the right answer for your question, please accept it as correct. Thanks. –  Alexandre Neto Apr 23 '13 at 8:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.