+6 votes


is it possible to set the font, color, image, background image, ...
to a tooltip or is it only plain text?
If it is not possible, is there maybe some useful workaround?

in Engine by (20 points)

1 Answer

+8 votes

The default tooltip is the same within a given GUI theme. You can change its style by creating a theme (if not done already), go to Theme -> Add Class Items, select either TooltipPanel or TooltipLabel in the selector and click Add all. This will add a style for tooltips in your themes that you can edit. Then, I guess applying the theme on your UI nodes will do the trick.

If you want a completely custom tooltip for different GUI elements (if the theme system isn't flexible enough), you could create a scene for the tooltip, then write a script that you put on GUI elements, detect mouse-over, and shows your tooltip scene.

by (27,896 points)

The custom tooltip as a new scene is a good idea. My approach:
1. Create a new scene with a panel and some labels or other nodes.
2. I created a Node on the CanvasLayer (ToolTipNode) and added this script to every GUI element that needs a tooltip:

extends Node

func _ready():
   self.connect("mouse_enter", self, "_mouse_enter")
   self.connect("mouse_exit", self, "_mouse_exit")

func _mouse_enter():

func _mouse_exit():

3. And a little script for the ToolTipNode:

extends Node

var scene

func _ready():
   scene = load('res://resources/scenes/ToolTip.scn').instance()

func showToolTip(isVisisble, tooltipValues):
       scene.set_pos(Vector2(0, 0)) #position
       # Do stuff like...
       # ...changing the labels on the tooltip scene 
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.