How to get input value from mouse click?

It works, but opens a new window with the button.

Do you know how I could attach it to my “Get Value” button in the GUI ?

I define my widget to display a button:

def setup(self):
  self.getValueButton = qt.QPushButton("Get Value")
  self.getValueButton.toolTip = "Get value from image"
  self.getValueButton.enabled = False
  self.getValueButton.connect('clicked(bool)', self.onGetValueButton)

A function to create a markup node, switch to Place fiducial mode and retrieve click position:

def getMousePointValue(self):
  return position

A function connected to my button:

def onGetValueButton(self):
  position = self.getMousePointValue()