MCPcopy
hub / github.com/PyQt5/PyQt / __init__

Method __init__

PyQtGraph/mouseFlow.py:29–38  ·  view source on GitHub ↗
(self, parent=None)

Source from the content-addressed store, hash-verified

27
28class MyWindow(QMainWindow, Ui_Form):
29 def __init__(self, parent=None):
30 super(MyWindow, self).__init__(parent)
31 self.setupUi(self)
32 x = np.linspace(-100, 100, 1000)
33 data = np.sin(x) / x
34 self.graphicsView.plot(data, pen=(255, 255, 255, 200))
35 self.label = pg.TextItem(text="横坐标:{}".format(0))
36 self.graphicsView.addItem(self.label)
37 self.setMouseTracking(True)
38 self.graphicsView.scene().sigMouseMoved.connect(self.onMouseMoved)
39
40 def onMouseMoved(self, evt):
41 if self.graphicsView.plotItem.vb.mapSceneToView(evt):

Callers

nothing calls this directly

Calls 2

setupUiMethod · 0.45
addItemMethod · 0.45

Tested by

no test coverage detected