have instructions under a button in the toolbar.
Is it possible? How can I add this help icon to my addon?
I don’t know what do you want…
If you want add some icon to your buttons you need to activate the icon addon
and then insert some icon to your button : (only you need to right click in the icon and paste in your code)
best
Adding a description under a button in the toolbars.
import bpy
class SimpleOperator(bpy.types.Operator):
"""This is where you can add the description."""
bl_idname = "object.simple_operator"
bl_label = "Simple Object Operator"
def execute(self, context):
print("OK")
return {'FINISHED'}
class LayoutDemoPanel(bpy.types.Panel):
bl_label = "Layout Demo"
bl_idname = "SCENE_PT_layout"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "scene"
def draw(self, context):
layout = self.layout
layout.operator("object.simple_operator")
def register():
bpy.utils.register_class(SimpleOperator)
bpy.utils.register_class(LayoutDemoPanel)
if __name__ == "__main__":
register()
“”“either like this”""
directly below class …(…):
or doc = “…” anywhere in the class
Good one, I did not know that.
It’s a standard python feature actually, really nice IMO. “”“is still preferable”"", and doc should actually also be used directly below class …:
If you want to access the doc string from outside however, it is much useful:
class Foo:
"""bar"""
# prints "Foo bar"
print(Foo.__name__, Foo.__doc__)