0

I want to display text about a sphere when the mouse clicks on it. I figured a tooltip in PythonOCC would be able to do this but I'm not sure about how I should write the code for it.

The code for the sphere is as follows. The resulting window is shown in the image.

from OCC.Display.SimpleGui import init_display
from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakeSphere
from OCC.Core.gp import gp_Pnt

display, start_display, add_menu, add_function_to_menu = init_display()

def sphere(centre):
    sphere = BRepPrimAPI_MakeSphere(centre, 1).Shape()
    display.DisplayShape(sphere, update=True)

if __name__ == '__main__':  
    sphere(gp_Pnt(68, 69, 130))
    start_display()

sphere window

I was hoping that the tooltip result could look something like this:

tooltip

James Lee
  • 61
  • 3

0 Answers0