Skip to content

2.5 DirectTooltip

Fireclaw edited this page Dec 29, 2020 · 1 revision

Simple text frame that floats next to the mouse and stays within the screen.

Example

from direct.gui import DirectGuiGlobals as DGG
from direct.gui.DirectFrame import DirectFrame

tt = DirectTooltip(text_scale=0.2, frameColor=(1, 1, 0.7, 1), pad=(.1,.1))

myFrame = DirectFrame()
myFrame.bind(DGG.ENTER, tt.show, ["This is a frame"])
myFrame.bind(DGG.EXIT, tt.hide)

Options

The tooltip is based on the DirectLabel and will accept all its parameters respectively

text: string
Text to be displayed on the tooltip

Functions

show(text=None):
Show the tooltip and adds a task to set the tooltips position next to the cursor. If text is not None, it will be used to update the text on the tooltip.

hide Hides the tooltip and removes the task to update its position.

Clone this wiki locally