Mon, 03/20/2023 - 04:04
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!
Attachments:
Wed, 05/24/2023 - 10:53
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.
Wed, 05/24/2023 - 15:29
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 fromAIS_InteractiveContext::DetectedOwner()
as in case of C++ API.