Thanks for the tip. LegendItem was a bit awkward for my needs, but reading
through its source code let me figure out how it worked (at least a little
bit), and GraphicsWidgetAnchor subclass and anchor() was the secret I was
missing. Turns out LabelItem already subclassed GraphicsWidgetAnchor, and
it was easier to use than LegendItem for my use case. So all I needed to do
was call anchor() on a LabelItem.
I threw this code in near the end of examples/Legend.py as a proof of
concept and it did exactly what I wanted:
label = pg.LabelItem("Error", size="36pt", color="FF0000")
label.setParentItem(win.graphicsItem())
label.anchor(itemPos=(0.5,0.5), parentPos=(0.5,0.5))
Thanks for your help!
Jeff
On Thursday, March 25, 2021 at 5:26:40 PM UTC-4 [email protected] wrote:
> See examples/Legend.py, which uses the LegendItem (which itself uses
> LabelItem) to put text in a fixed position inside the plot.
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyqtgraph/8fc1c152-6366-4a4d-a13c-c1c3d3f5fa6en%40googlegroups.com.