How to display X, Y position on mouse hover?

89 views
Skip to first unread message

Hamza Khan

unread,
May 3, 2021, 2:32:34 PM5/3/21
to pyqtgraph
Please have a look.. here is my question and code please any one help Thanks

Martin Chase

unread,
May 3, 2021, 5:06:26 PM5/3/21
to pyqt...@googlegroups.com
Hamza,


Does that get you what you need?

Good luck,
 - Martin @outofculture he/him

Hamza Khan

unread,
May 3, 2021, 5:12:34 PM5/3/21
to pyqt...@googlegroups.com
Hi,
In the example of crosshair.py Window is created using GraphicsLayoutWidget which support LabelItem.
In my code i used QVBoxLayout, wo don't know how to implement cross hair in my code.
If you can you help i will be very thankful to you
Thanks

--
You received this message because you are subscribed to the Google Groups "pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyqtgraph+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/CAD_p8v1eZmpXhqOL%2B7nNHr_TLn0_KZbEAzQhh%3DJw0P_k0Oab-A%40mail.gmail.com.

Ognyan Moore

unread,
May 3, 2021, 5:30:43 PM5/3/21
to pyqt...@googlegroups.com
Hi Hamza,

I think there is some confusion between the Graphics View framework (which handles the use of QGraphicsItems, which is ~98% of where pyqtgraph operates in), and QtWidgets, which are the more generic UI components.  You can embed a graphics view within a QtWidget (that's how we get plots in windows), but there is no way*  to put a QWidget within a Graphics View (not technically true, there is QGraphcisProxyWidget, but you want no part of that as it will kill any performance).

If you're using a GraphicsLayoutWidget, and are looking to display text within the plot, you want to be using a TextItem (which is a QGraphicsItem).  LabelItem is a QWidget, which I believe is used as a helper object for ParameterTrees.  

In addition to the crosshair example that Martin linked, there is also the InfiniteLine example which likely has some similar behavior to what you're looking for.


Reply all
Reply to author
Forward
0 new messages