Message posté par : Njoy
----------------------------------------
Bonjour,
Je fais ainsi :
-----------------
Code :
def add_action(
self,
icon_path,
text,
callback,
enabled_flag=True,
add_to_menu=True,
add_to_toolbar=True,
status_tip=None,
whats_this=None,
parent=None):
icon = QIcon(icon_path)
action = QAction(icon, text, parent)
action.triggered.connect(callback)
action.setEnabled(enabled_flag)
if status_tip is not None:
action.setStatusTip(status_tip)
if whats_this is not None:
action.setWhatsThis(whats_this)
if add_to_toolbar:
self.iface.addToolBarIcon(action)
if add_to_menu:
self.iface.addPluginToMenu(
self.menu,
action)
self.actions.append(action)
return action
def initGui(self):
"""Create the menu entries and toolbar icons inside the QGIS
GUI."""
icon_path = ':/plugins/FTTH_Etiquettes/icon.png'
self.add_action(
icon_path,
text=self.tr(u'FTTH_easy2'),
callback=self.run,
parent=self.iface.mainWindow())
# will be set False in run()
self.first_start = True
-----------------
----------------------------------------
Le message est situé
https://georezo.net/forum/viewtopic.php?pid=337840#p337840
Pour y répondre : qgis_fr(a)ml.georezo.net ou reply de votre messagerie
Pour vous désabonner connectez-vous sur le forum puis Profil / Abonnement
--
Association GeoRezo - le portail géomatique
https://georezo.net