How could I get the real-time rotation angles of the 3D image? SOS!

Operating system:windows

Slicer version:4.8.1
Hi everyone,
I want to know how to get the real-time rotation angles of the 3D image? Thus, I can know the degree of rotation of the C-arm during surgery. I’ve seen people do this before, but I don’t know how. They do this through Python Interactor as the picture I attached.

You can find a script that prints anatomical angles (RAO/LAO, CRA/CAU) in the corner of a 3D view in this post.