Discussion:
[pyqtgraph] How to zoom in using a button
Amin M
2018-11-06 18:55:18 UTC
Permalink
Hello, I'm using PyQTGraph along with PyQT5, and I've added a
GraphicsLayoutWidget, with mouse events to add markers.

canvas_ruler = pg.GraphicsLayoutWidget()
formLayout.addWidget(self.canvas_ruler)
plot_ruler = canvas_ruler.addPlot(name="Ruler")

plot_ruler.hideAxis('left')

canvas_ruler.scene().sigMouseMoved.connect(self.mouseMoved)
canvas_ruler.scene().sigMouseClicked.connect(self.mouseClicked)
plot_ruler.setMouseEnabled(x=True, y=False)

What I would like to add, are 2 buttons, to zoom in and zoom out, currently
the mouse wheel event, does zooming in/out. But I want to disable that and
add 2 buttons for it. I probably should:
setMouseEnabled(x=False, y=False)

But I don't know how to trigger the zoom using code, I couldn't find it's
APIs, like sigMouseMoved.connect.

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/8aa819c8-df19-47d2-b43d-e7fd6f1f27ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...