Vizard 7 » Reference » Graphical user interfaces (GUIs) » viztip
7.6

viztip

The viztip library allows you to assign a tooltip attribute to any node object that contains the tooltip text. Once you create an instance of the viztip.ToolTip object, it will automatically display an on-screen tooltip when the mouse is over the node. The following example demonstrates this:

import viz
viz.go()

viz.add('tut_ground.wrl')

#Create models with tooltip text
ball1 = viz.add('ball.wrl',pos=(-2,1,5))
ball1.tooltip = 'Ball 1'

ball2 = viz.add('ball.wrl',pos=(0,1,5))
ball2.tooltip = 'Ball 2'

ball3 = viz.add('ball.wrl',pos=(2,1,5))
ball3.tooltip = 'Ball 3'

#Create a tool tip object
import viztip
tip = viztip.ToolTip()

Methods and Events

A number of methods are available on the Tooltip object. These control properties such as the time for the Tooltip to appear, whether it tracks the mouse position, it's visibility, and more. Events generated after a Tooltip object have been created include the viztip.TOOLTIP_BEGIN_EVENT and viztip.TOOLTIP_END_EVENT:

import viz
viz.go()

gallery = viz.add('gallery.ive')

#Create models with tooltip text
ball = viz.add('ball.wrl',pos=(0,1.8,2))
ball.tooltip = 'Ball'

#Create a tool tip object
import viztip
tip = viztip.ToolTip()

#set initial tooltip message and position
tip.message('Move the cursor over the ball')
tip.translate(300,50)

#action to add when mouse is over a tooltip object
spin = vizact.spin(0,1,0,45)

#handle toolpit events
def beginTip(e):
    e.node.addAction(spin)
    
viz.callback(viztip.TOOLTIP_BEGIN_EVENT,beginTip)   

def endTip(e):
    e.node.endAction()
    
viz.callback(viztip.TOOLTIP_END_EVENT,endTip)

See also

In this section:

User interface basics

GUI elements

Getting data from GUI elements

GUI appearance

vizinfo

vizmenu

vizinput

vizdlg

vizconfig

viztip

Displaying HTML

GUI command table

Other sections:

Event Basics

Action basics

Text node basics

Example scripts:

vizInfo

vizMenu

Prompt