# Auto Refresh UI

**URL:** <https://discourse.slicer.org/t/auto-refresh-ui/17780>\
**Category:** Development\
**Tags:** segmentation\
**Created:** [May 25, 2021, 12:40am UTC](https://discourse.slicer.org/t/auto-refresh-ui/17780 "2021-05-25T00:40:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SachidanandAlle](https://avatars.discourse-cdn.com/v4/letter/s/4491bb/32.png) [@SachidanandAlle](https://discourse.slicer.org/u/SachidanandAlle)\
**Post date:** [May 25, 2021, 12:40am UTC](https://discourse.slicer.org/t/auto-refresh-ui/17780/1 "2021-05-25T00:40:11Z")

</div>

Train task run in server.  
Periodically I would like to trigger a status check and update some UI button.

> <https://github.com/Project-MONAI/MONAILabel/blob/main/plugins/slicer/MONAILabel/MONAILabel.py#L184-L186>

Basically I have Train start, status\_check and stop buttons  
When I click start… we switch and enable stop button. After sometime the actual training is finished.

However server provides a method to query the status. How to do it behind the scene… I mean how to simulate the behaviour of auto click for status button for every N seconds.

---

<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:** [May 25, 2021, 3:29am UTC](https://discourse.slicer.org/t/auto-refresh-ui/17780/2 "2021-05-25T03:29:19Z")

</div>

You can set up a QTimer to run a method periodically. See for example in Endoscopy module:

> <https://github.com/Slicer/Slicer/blob/d421cacd00045aee27edc164a5f71bc650b2361b/Modules/Scripted/Endoscopy/Endoscopy.py#L57-L59>
