Hi Andrea,
I have a little time before I start my work-day, but at a glance, I suspect what the issue here is a difference between painter coordinates and a difference between viewbox coordinates, which don't match up.
For your distance object, I would highly recommend you inherit from
TextItem, it offers anchor/position capability, and the text size will remain the same regardless of the zoom level, which appears to be a good chunk of the code that you're trying to manage there. You can add just the little bits you need
The example you're trying to work with feels
really close to the
InfiniteLine.py example's usage of
pg.TargetItem (
docs for TargetItem) (in the examples, the target is a symbol, but it supports drawing any QPainterPath object, and maybe the line underneath the text readout can just be a QPainterPath object that just represents 1 line.
Sorry I can't be more specific with where the bug is, but debugging a 500 line python file before my work starts isn't always feasible. Oh, and lastly I would suggest not setting `useOpenGL` while getting the initial version working. While OpenGL can add significant performance boosts, there are a number of bugs (in our library, Qt and the openGL implementations on each OS) that could cause confusion. Best get a non-openGL version working first and go from there.
Sorry I can't be more specific.