# How to get input value from mouse click?

**URL:** <https://discourse.slicer.org/t/how-to-get-input-value-from-mouse-click/5903>\
**Category:** Development\
**Created:** [February 24, 2019, 1:49pm UTC](https://discourse.slicer.org/t/how-to-get-input-value-from-mouse-click/5903 "2019-02-24T13:49:42Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![zenox](https://avatars.discourse-cdn.com/v4/letter/z/bb73d2/32.png) [@zenox](https://discourse.slicer.org/u/zenox)\
**Post date:** [February 25, 2019, 10:16pm UTC](https://discourse.slicer.org/t/how-to-get-input-value-from-mouse-click/5903/10 "2019-02-25T22:16:48Z")

</div>

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()
```

---

_[View the full topic](https://discourse.slicer.org/t/how-to-get-input-value-from-mouse-click/5903)._
