# How to add threshold computation and make the button apply to work

**URL:** <https://discourse.slicer.org/t/how-to-add-threshold-computation-and-make-the-button-apply-to-work/18492>\
**Category:** Development\
**Created:** [July 2, 2021, 7:46pm UTC](https://discourse.slicer.org/t/how-to-add-threshold-computation-and-make-the-button-apply-to-work/18492 "2021-07-02T19:46:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rafael.cristo](https://avatars.discourse-cdn.com/v4/letter/r/e274bd/32.png) [@rafael.cristo](https://discourse.slicer.org/u/rafael.cristo)\
**Post date:** [July 2, 2021, 7:46pm UTC](https://discourse.slicer.org/t/how-to-add-threshold-computation-and-make-the-button-apply-to-work/18492/1 "2021-07-02T19:46:38Z")

</div>

Hi, everyone.

I am trying to implement a python code to create a module in 3d slicer, howevery I don’t know how to activate the button apply. Basically I have an input volume that will be 1 or 0 comparing with a threshold value, however I don’t know how to make the button apply works.

# 

```
    # Apply Button
    #
    self.apply_button = qt.QPushButton("Apply")
    self.apply_button.toolTip = "Run the algorithm."
    self.apply_button.enabled = False
    parameters_form_layout.addRow(self.apply_button)

```

It is considered a widget. How can I make it works!?

Best,  
Rafael Cristo

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [July 7, 2021, 4:46pm UTC](https://discourse.slicer.org/t/how-to-add-threshold-computation-and-make-the-button-apply-to-work/18492/2 "2021-07-07T16:46:44Z")

</div>

Hi -

You need to connect the button to a callback slot. You can read through the developer tutorials for all the details.
