How to zoom in using a button

34 views
Skip to first unread message

Amin M

unread,
Nov 6, 2018, 1:55:18 PM11/6/18
to pyqtgraph
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
Reply all
Reply to author
Forward
0 new messages