Hi, do you know how can I add a tooltip to an operator button?
I have a dictionary with keys id, name, description.
This dictionary structure is placed in a list to compose the buttons.
for i in guiList:
op = col.operator("myoperator", text=i["name"])
The code works fine, obviously the text parameter exists, but is there any parameter for tooltips?
What I would like to do additionally is to offer some tooltips when the user hovers above the button.
Tooltip texts can’t be given dynamically. The bl_description property of a class is taken as tooltip and can’t be overriden.
EnumProperty() supports descriptions for every item however.
All right, I converted the code to use operator_enum instead of a for loop and now it’s all good.
6 years later, and this is now a feature of blender 2.81.
From the docs:
With an operator defined as (irrelevant parts omitted):
def description(cls, context, properties):
return "Arg is: " + properties.arg
The following button would have a tooltip that says “Arg is: FOO”.
layout.operator('wm.tooltip_test').arg = 'FOO'
This is mainly intended for cases when multiple similar but distinct operations are implemented for technical reasons as one operator with a mode switch parameter.