标签中的QGIS-Python图标

时间:2012-02-17 05:20:16

标签: python qgis plugins

我正在使用qgis的python插件。我开发了我的插件并在本地运行到QGIS。 我的插件名称为 DlgAbout.py 。它的标签名为徽标,用于在其中放置图片。代码为

self.logo.setPixmap( QtGui.QPixmap( "icons/bannertile.PNG" ) )

当我正常运行时,它会正确显示 enter image description here

但是当我将其同步到QGIS中时,徽标不会显示。

enter image description here

我的文件 DlgAbout.py 路径为 C:\ rt_sql_layer_ui ,图标位于 C:\ rt_sql_layer_ui \ icons 中。 可能是什么问题??

我试过这样的事情:

self.logo.setPixmap( QtGui.QPixmap( ":/icons/bannertile.PNG" ) )

1 个答案:

答案 0 :(得分:3)

最好的办法是创建Qt resource file,然后您可以使用":/icons/bannertile.PNG"语法。

使用pyrcc4来编译.qrc文件。