# Synchronize slice views widgets with widgets created in the Python console

**URL:** <https://discourse.slicer.org/t/synchronize-slice-views-widgets-with-widgets-created-in-the-python-console/424>\
**Category:** Development\
**Created:** [June 2, 2017, 1:24pm UTC](https://discourse.slicer.org/t/synchronize-slice-views-widgets-with-widgets-created-in-the-python-console/424 "2017-06-02T13:24:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)\
**Post date:** [June 2, 2017, 1:24pm UTC](https://discourse.slicer.org/t/synchronize-slice-views-widgets-with-widgets-created-in-the-python-console/424/1 "2017-06-02T13:24:15Z")

</div>

Hi all,

I would like to use Python to synchronize a custom `qMRMLNodeComboBox` with, for example, the Foreground combo box of the Green slice view. Same thing with a slider for the opacity. So when I modify the node in my combo box, the green slice is modified and vice versa. I tried creating a `qMRMLSliceControllerWidget` as in the `View Controllers` module, but most methods seem not to be wrapped in Python. Do you have any ideas?

---

<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:** [June 2, 2017, 2:06pm UTC](https://discourse.slicer.org/t/synchronize-slice-views-widgets-with-widgets-created-in-the-python-console/424/2 "2017-06-02T14:06:53Z")

</div>

Let me know what methods you would like to use and I can make sure those are Python-wrapped.

If you only need a simple node selector, then just add an observer to the slice node to get notification about volume selection changes.

---

<div class="post-metadata">

**Author:** ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)\
**Post date:** [June 2, 2017, 2:25pm UTC](https://discourse.slicer.org/t/synchronize-slice-views-widgets-with-widgets-created-in-the-python-console/424/3 "2017-06-02T14:25:11Z")

</div>

What I tried to do is mimic [this method](https://github.com/Slicer/Slicer/blob/ff4a605ef55fdda4fbd8c20cee41e4b184461f72/Modules/Loadable/ViewControllers/qSlicerViewControllersModuleWidget.cxx#L85) in `View Controllers`, but I guess it’s easier to add an observer to the slice node. How can I find out the right observer to add?

---

<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:** [June 2, 2017, 2:32pm UTC](https://discourse.slicer.org/t/synchronize-slice-views-widgets-with-widgets-created-in-the-python-console/424/4 "2017-06-02T14:32:35Z")

</div>

Probably the best is to check the source code of the view controller widgets:

> <https://github.com/Slicer/Slicer/blob/master/Libs/MRML/Widgets/qMRMLSliceControllerWidget.cxx#L751-L754>
