[Qgis-user] python macros is working?

Salvatore Larosa lrssvtml at gmail.com
Fri Sep 28 01:51:52 PDT 2012


Hi,

2012/9/28 ASAHI Kosuke <asahi at hcc.co.jp>

> Hi all,
>
> When I use python console, following small code works fine.
>  def openProject():
>     view = qgis.gui.QgsMessageViewer()
>     view.setMessage("test", qgis.core.QgsMessageOutput.MessageText)
>     view.showMessage(True)
>  openProject()
>
> I typed following code to Python macros Tab on QGIS Master.
> Nothing happen, after Save and Open Porject.
>  def openProject():
>     view = qgis.gui.QgsMessageViewer()
>     view.setMessage("test", qgis.core.QgsMessageOutput.MessageText)
>     view.showMessage(True)
>
>  def saveProject():
>     pass
>
>  def closeProject():
>     pass
>
> Do I need to change any settings or my code?
>

Add simply "import qgis.gui"

 def openProject():

import qgis.gui

view = qgis.gui.QgsMessageViewer()

view.setMessage("test", qgis.core.QgsMessageOutput.MessageText)

view.showMessage(True)


Regards,


-SL




>
> Regards,
>
> --
> ASAHI Kosuke
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>



-- 
Salvatore Larosa
linkedIn: http://linkedin.com/in/larosasalvatore
twitter: @lrssvt
skype: s.larosa
IRC: lrssvt on freenode
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20120928/4325c352/attachment.html>


More information about the Qgis-user mailing list