Python FreeCADGui is a Python module in FreeCAD that provides a Python interface to the graphical user interface of FreeCAD software. The addIconPath() method is used to add a new path for icons in the FreeCAD interface. This allows us to customize the interface by adding new icons, or change the default icons if needed.
Here are some examples of using the addIconPath() method:
Example 1: Adding a new icon path to the default FreeCAD icon path:
import FreeCADGui
path = '/home/user/icons/'
FreeCADGui.addIconPath(path)
This example adds the '/home/user/icons/' path to the default icon path in FreeCAD. This means that FreeCAD will look for icons in this new path when displaying UI elements.
Example 2: Adding a new icon path as a subdirectory to the user's home directory:
import os import FreeCADGui
home = os.path.expanduser("~")
path = os.path.join(home, 'icons')
FreeCADGui.addIconPath(path)
This example adds a new 'icons' directory under the user's home directory to the icon search path in FreeCAD. This means that FreeCAD will look for icons in the 'icons' directory under the user's home directory when displaying UI elements.
Example 3: Adding a new icon path as a part of a plugin or addon package:
This example adds an 'icons' directory located in the same directory as the current Python script to the icon search path in FreeCAD. This is useful when creating a plugin or addon package that includes custom icons.
The package library for Python FreeCADGui appears to be FreeCAD itself.
Python FreeCADGui.addIconPath - 34 examples found. These are the top rated real world Python examples of FreeCADGui.addIconPath extracted from open source projects. You can rate examples to help us improve the quality of examples.