title: Return mouse click coordinates as a list from a pyqtgraph
body: <p>I am quite new to pyqtgraph and have been learning python for some time. I am trying to get mouse click coordinates from the pyqtgraph plotitem.
  Here's what I have so far.</p>
  <pre class="lang-py prettyprint-override"><code>class CrossHair():
      def __init__(self, win,row=0,col=0):
          self.label = pg.LabelItem(justify='right')
          self.p1 = win.getItem(row=row,col=col)
          self.p1.setAutoVisible(x=True,y=True)
          win.addItem(self.label,row=row,col=col)
          self.vLine = pg.InfiniteLine(angle=90, movable=False)
          self.hLine = pg.InfiniteLine(angle=0, movable=False)
          self.vb = self.p1.vb
          self.p1.addItem(self.vLine, ignoreBounds=True)
          self.p1.addItem(self.hLine, ignoreBounds=True)
          self.proxy = pg.SignalProxy(self.p1.scene().sigMouseMoved, rateLimit=60, slot=self.mouseMoved)
          self.p1.scene().sigMouseClicked.connect(self.mouseClicked)
          #self.p1.scene().sigMouseMoved.connect(self.mouseMoved)
      def mouseMoved(self, evt):
          pos = evt[0]  ## using signal proxy turns original arguments into a tuple
          if self.p1.sceneBoundingRect().contains(pos):
              mousePoint = self.vb.mapSceneToView(pos)
              self.label.setText(&quot;&lt;span style='font-size: 10pt'&gt;x=%0.1f,   &lt;span style='color: red'&gt;y=%0.1f&lt;/span&gt;&quot;%(mousePoint.x(),mousePoint.y()))
              self.vLine.setPos(mousePoint.x())
              self.hLine.setPos(mousePoint.y())
      def mouseClicked(self,event):
          global mouse_coordinates
          mouse_coordinates=[]
          pos = event.scenePos()
          mousePoint = self.vb.mapSceneToView(pos)
          mouse_coordinates = [mousePoint.x(),mousePoint.y()]
          return mouse_coordinates
          #self.sigMouseClicked.disconnect()
  </code></pre>
  <p>I want to define a function <code>get_points(win)</code> which takes the current pyqtgraph window, draws a crosshair and whenever I click, returns a list of mouse click coordinates. After a single click, I don't want it to register any more coordinates unless the I call the function again.</p>
  <p>I wrote something like this but it did not work:</p>
  <pre class="lang-py prettyprint-override"><code>def get_points(win):
      ch = CrossHair(win)
      ch.p1.scene().sigMouseClicked.connect(ch.mouseClicked)
  
  </code></pre>
  <p>Any help or suggestions is greatly appreciated!</p>