# Update Values at Widget

**URL:** <https://discourse.slicer.org/t/update-values-at-widget/8279>\
**Category:** Development\
**Tags:** python\
**Created:** [September 3, 2019, 4:11pm UTC](https://discourse.slicer.org/t/update-values-at-widget/8279 "2019-09-03T16:11:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![siaeleni](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@siaeleni](https://discourse.slicer.org/u/siaeleni)\
**Post date:** [September 3, 2019, 4:11pm UTC](https://discourse.slicer.org/t/update-values-at-widget/8279/1 "2019-09-03T16:11:31Z")

</div>

Hello,

I want to clarify and underand how to set values from Logic to the GUI.  
So, I have a python module and I have Widget class where I define all my controls, for example:

> class Widget(ScriptedLoadableModuleWidget):
> 
> self.textBox = qt.QLineEdit()

But I want from the Logic class to update the self.textBox text with the value.

> class Logic(ScriptedLoadableModuleLogic):  
> value = 8

What is the right way to do that?

---

<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:** [September 3, 2019, 5:09pm UTC](https://discourse.slicer.org/t/update-values-at-widget/8279/2 "2019-09-03T17:09:01Z")

</div>

You should never update the GUI from the logic. The logic should not require, should not even know about that there is a GUI or not. Instead, the logic can update MRML nodes and since the GUI shows the current state of the MRML nodes, changes will automatically appear on the GUI. See [these tutorials](https://www.slicer.org/wiki/Documentation/Nightly/Training#PerkLab.27s_Slicer_bootcamp_training_materials) for details.
