Info on Hover

Hi there!

I am using Python to create some Add-ons, and I would like the user to see information about some of the properties (input fields, buttons, dropdowns, etc.) when he hovers the mouse on them. For example, in the HOME/Origin/Snap menu, when the user hovers on ‘1 Point’, he can see the text ‘Snap component with a single click’.

Does anyone know if and how this can be achieved with Python? I checked the documentation and couldn’t find anything on this.

Those are called tooltips. I think there is a way to assign tooltips for properties of Python commands through the localization system.


from vcApplication import *

cmdName = "cmdTipExample"
netCommand = findCommand("netCommand")
netCommand.execute("SetLocalizationCommand", "English", "Python", cmdName, "Tooltip", "Tooltip Example")

def OnStart():  
  cmduri = getApplicationPath() + ""
  cmd = loadCommand(cmdName, cmduri)
  addMenuItem("VcTabHome/VcRibbonTools", "TipExample", -1, cmdName, "Help/rHelp")

image image

from vcCommand import *
from vcHelpers.Application import *

cmdName = "cmdTipExample"

app = getApplication()
cmd = getCommand()
netCommand = app.findCommand("netCommand")

def getPanelProperty(propertyValue, propertyName, tooltip):
  property = cmd.getProperty(propertyName)
  if not property:
    property = cmd.createProperty(propertyValue, propertyName)
  netCommand.execute("SetLocalizationCommand", "English", "Python", "%s.%s" % (cmdName, propertyName), "Description", tooltip)
  return property

def OnPrintMe(arg):
  print "Hello %s" % me.Value

def OnStart():
  global me, printMe
  me = getPanelProperty(VC_STRING, "Me", "This is me")  
  printMe = getPanelProperty(VC_BUTTON, "PrintMe", "Click to print me")  
  printMe.OnChanged = OnPrintMe
1 Like