Displaying a tooltip when a 3D object is clicked in pythonOCC 3D viewer

Forums: 

In PythonOCC, I am trying to make a tooltip or popup of sorts to display some text when I click a sphere that I created in 3D space. The code that I used and the resulting window is attached below. I would greatly appreciate it if anyone could explain how I can add a tooltip using PythonOCC to directly show info about a highlighted object. Some potential tooltip results are also attached below. Thank you!

Daiva Daiva's picture

Hi James,
The following example does not create a tooltip, but it prints the information about a klicked object into the terminal:
https://github.com/tpaviot/pythonocc-demos/blob/master/examples/core_dis...

Hope it helps a bit.

gkv311 n's picture

I cannot find any reliable callback in PythonOCC for tracking mouse movements, only for mouse clicks (.register_select_callback()) as in the sample referred by Daiva. So I guess you'll need asking the project to add such callbacks or hack in somehow using Qt/Wx-specific implementation.

The label itself could be displayed via AIS_TextLabel directly in 3D viewer or via some GUI widget. Dynamically highlighted object could be retrieved from AIS_InteractiveContext::DetectedOwner() as in case of C++ API.