既存のプラグインツールバーにボタンを追加

今回はプラグインのinitGuideでツールバーにボタンを追加しボタンが押されたらメッセージボックスを表示
インポートを追加
[code]
from PyQt5.QtWidgets import QMessageBox, QAction
from PyQt5.QtGui import QIcon
[/code]
[code]
def initGui(self):
"""Create the menu entries and toolbar icons inside the QGIS GUI."""
testAction = QAction(QIcon(os.path.dirname(__file__) + ‘/niko.png’), ‘TEST’, self.iface.mainWindow())
testAction.triggered.connect(self.test)
self.iface.addToolBarIcon(testAction)
def test(self):
QMessageBox.about(self, "Title", "Message")
[/code]

