# How to log click on a button in segment editor?

**URL:** https://discourse.slicer.org/t/how-to-log-click-on-a-button-in-segment-editor/35574
**Category:** Development
**Tags:** segmentation, python
**Created:** [April 17, 2024, 11:51pm UTC](https://discourse.slicer.org/t/how-to-log-click-on-a-button-in-segment-editor/35574 "2024-04-17T23:51:16Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![lskog](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lskog/32/70080_2.png) [@lskog](https://discourse.slicer.org/u/lskog)
#### Post date: [April 17, 2024, 11:51pm UTC](https://discourse.slicer.org/t/how-to-log-click-on-a-button-in-segment-editor/35574/1 "2024-04-17T23:51:16Z")

</div>

Hello everyone, while trying to create personal module for slicer a problem occured. I need to log then the user click on “add” button in segment editor and changes tools. I want to create a timer, which will log how long it takes to make a segment. A lost hope to create the whole extension, but still want to make it work through built-in console. Any suggestions on how to log buttons?  
Thanks

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [April 17, 2024, 11:56pm UTC](https://discourse.slicer.org/t/how-to-log-click-on-a-button-in-segment-editor/35574/2 "2024-04-17T23:56:47Z")

</div>

User Statistics module in Sandbox extension collects data about what modules are used, which Segment Editor effects are used and for how long, on what segments. It takes into account idle time (if the user leaves the computer or switches to another application then the clock stops). It is a Python scripted module, so you can extend it to record any additional details.

---

<div class="post-metadata">

### Author: ![lskog](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lskog/32/70080_2.png) [@lskog](https://discourse.slicer.org/u/lskog)
#### Post date: [April 18, 2024, 9:02pm UTC](https://discourse.slicer.org/t/how-to-log-click-on-a-button-in-segment-editor/35574/3 "2024-04-18T21:02:56Z")

</div>

Thank you! We are currently trying to use this module in our work, or adapt its functions to our purposes. I hope it is possible for me not to mark the problem as solved right now, because I am sure, that I’ll face something again.

---

<div class="post-metadata">

### Author: ![lskog](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lskog/32/70080_2.png) [@lskog](https://discourse.slicer.org/u/lskog)
#### Post date: [April 25, 2024, 7:59am UTC](https://discourse.slicer.org/t/how-to-log-click-on-a-button-in-segment-editor/35574/4 "2024-04-25T07:59:58Z")

</div>

Thank you again for your reply. It was exciting experience. The feature was realized)

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [April 30, 2024, 2:39am UTC](https://discourse.slicer.org/t/how-to-log-click-on-a-button-in-segment-editor/35574/5 "2024-04-30T02:39:33Z")

</div>

Great to hear that you managed to implement what you needed. If you think this could be a useful feature in general then I would encourage tou to contribute it back to the community by sending a pull request to the Sandbox repository with your proposed changes.
