Hello Geri,
You have to put your icon in the same folder as your script :
your_scripts_folder/
your_script.py
your_icon.png (or.svg)You need then to create the resources file for your icon and compile it.
Create that file :
<RCC>
<qresource prefix="/ your_scripts_folder" >
<file>your_icon.png</file>
</qresource>
</RCC>and save it in your_scripts_folder as "resources.qrc"
Make sure you have "Pyside2-rcc.exe" script in your Python Scripts folder.
What I do is to get the same Python version (
https://www.python.org/downloads/release/python-352/) as that of Metashape in another folder and download inside the Pyside2 module (
https://pypi.org/project/PySide2/).
Don't forget to add Pyside2 module to your PATH .
Then open a command prompt from your_scripts_folder and type:
"pyside2-rcc -o resource.py resources.qrc"This will compile your file in python format.
Now you should have:
your_scripts_folder/
your_script.py
your_icon.png (or.svg)
resources.qrc
resources.pyAdd "f
rom PySide2.QtGui import QIcon" at the beginning of your_script.py and
ico = ":/your_icon.png"
Metashape.app.addMenuItem("yout script name", your function,"!",icon=ico) where "!" is a shortcut if need.
Take a look here :
https://github.com/Seboon/Metashape_ScriptReloader/tree/master/ReloaderFiles for an example.
You should now have a icon in your toolbar.
Best regards!