You can create a widget and add it to Main.layoutManager.uiGroup
, then place it one the screen appropriately:
let label = new St.Label({ text: 'Tooltip' });
Main.layoutManager.uiGroup.add_child(label);
Main.layoutManager.uiGroup.set_child_above_sibling(label, null);
let [x, y] = someParentActor.get_transformed_position();
label.set_position(x, y);
Generally I’d avoid tooltips, since they aren’t very accessible and there’s other UX concerns, but that’s more or less how you would do it.