我想在将鼠标悬停在ImageView()的框架上时获得鼠标的坐标。 这是我的代码的几行:
self.frameContainer = pg.ImageView()
self.frameContainer.setImage(self.frame)
self.frameContainer.scene().sigMouseMoved.connect(self.mouseMoveds)
def mouseMoveds(self, evt):
pos = evt
if self.frameContainer.sceneBoundingRect().contains(pos):
self.mousePoint = self.frameContainer.plotItem.vb.mapSceneToView(pos)
print(self.mousePoint.x()) #For Test
一旦运行程序,我会收到以下错误消息:
TypeError: 'GraphicsScene' object is not callable
对于PlotWidget()实例,类似的代码可以很好地工作。