# Module 'PythonQt.qSlicerMarkupsModuleWidgets' has no attribute 'qMRMLMarkupsROIWidget'?

**URL:** <https://discourse.slicer.org/t/module-pythonqt-qslicermarkupsmodulewidgets-has-no-attribute-qmrmlmarkupsroiwidget/19675>\
**Category:** Development\
**Created:** [September 14, 2021, 9:14pm UTC](https://discourse.slicer.org/t/module-pythonqt-qslicermarkupsmodulewidgets-has-no-attribute-qmrmlmarkupsroiwidget/19675 "2021-09-14T21:14:22Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![jumbojing](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jumbojing/32/10811_2.png) [@jumbojing](https://discourse.slicer.org/u/jumbojing)\
**Post date:** [September 14, 2021, 9:14pm UTC](https://discourse.slicer.org/t/module-pythonqt-qslicermarkupsmodulewidgets-has-no-attribute-qmrmlmarkupsroiwidget/19675/1 "2021-09-14T21:14:22Z")

</div>

Why?howto use qMRMLMarkupsROIWidget by python?

> [CRITICAL][Stream] 15.09.2021 04:43:02 (unknown:0) - AttributeError: module ‘PythonQt.qSlicerMarkupsModuleWidgets’ has no attribute ‘qMRMLMarkupsROIWidget’

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [September 14, 2021, 9:17pm UTC](https://discourse.slicer.org/t/module-pythonqt-qslicermarkupsmodulewidgets-has-no-attribute-qmrmlmarkupsroiwidget/19675/2 "2021-09-14T21:17:28Z")

</div>

If trying to instantiate a reference to a `qSlicerMarkupsROIWidget` object you should do the following from python. Things should not be accessed through the “PythonQt” namespace. Use “slicer” instead.

```python
roi_widget = slicer.qSlicerMarkupsROIWidget()

```

---

<div class="post-metadata">

**Author:** ![jumbojing](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jumbojing/32/10811_2.png) [@jumbojing](https://discourse.slicer.org/u/jumbojing)\
**Post date:** [September 14, 2021, 9:26pm UTC](https://discourse.slicer.org/t/module-pythonqt-qslicermarkupsmodulewidgets-has-no-attribute-qmrmlmarkupsroiwidget/19675/3 "2021-09-14T21:26:49Z")

</div>

> [@jamesobutler](#):
>
> ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/4/b40e8514d767dca90a817dddc39461c1a0344b23.png)
> 
> `roi_widget = slicer.qSlicerMarkupsROIWidget()`

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/3/8391b9746ca5d6c92f67c0dd67ef6e6b6eb69502.png)  
Where is the ROIwidget?

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [September 14, 2021, 10:28pm UTC](https://discourse.slicer.org/t/module-pythonqt-qslicermarkupsmodulewidgets-has-no-attribute-qmrmlmarkupsroiwidget/19675/4 "2021-09-14T22:28:42Z")

</div>

@lassoan Is there something wrong with `qSlicer` type widgets? `qSlicerMarkupsROIWidget` and `qSlicerVolumeRenderingModuleWidget` don’t appear to show anything?

When `qSlicerMarkupsROIWidget` was `qMRMLMarkupsROIWidget` prior to [this commit](https://github.com/Slicer/Slicer/commit/13dc27c8dbc424ce6c0d14b90e9cbf4d213519e1) in Slicer 4.11.20210226 it can be shown successfully.  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/7/17d43256e3ab73dd83ccca6cc91ae00692d26c2e.png)

In latest Slicer Preview it is just blank  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/b/eb06b70543f87b44af774e79509de1537fa75f54.png)

---

<div class="post-metadata">

**Author:** ![jumbojing](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jumbojing/32/10811_2.png) [@jumbojing](https://discourse.slicer.org/u/jumbojing)\
**Post date:** [September 14, 2021, 10:50pm UTC](https://discourse.slicer.org/t/module-pythonqt-qslicermarkupsmodulewidgets-has-no-attribute-qmrmlmarkupsroiwidget/19675/5 "2021-09-14T22:50:44Z")

</div>

In latest Slicer Preview it is just blank？？？

---

<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 15, 2021, 1:09am UTC](https://discourse.slicer.org/t/module-pythonqt-qslicermarkupsmodulewidgets-has-no-attribute-qmrmlmarkupsroiwidget/19675/6 "2021-09-15T01:09:29Z")

</div>

Good catch. We did not notice this design error during the recent markups module rework. There are several issues, I’ve summarized them in [here](https://github.com/Slicer/Slicer/issues/5857). @RafaelPalomar is there a chance that you can work on this before finalizing Slicer5 (in the next 2 weeks or so)?

---

<div class="post-metadata">

**Author:** ![RafaelPalomar](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rafaelpalomar/32/1436_2.png) [@RafaelPalomar](https://discourse.slicer.org/u/RafaelPalomar)\
**Post date:** [September 21, 2021, 8:06am UTC](https://discourse.slicer.org/t/module-pythonqt-qslicermarkupsmodulewidgets-has-no-attribute-qmrmlmarkupsroiwidget/19675/7 "2021-09-21T08:06:27Z")

</div>

Hello. Yes I will have a look at it.

---

<div class="post-metadata">

**Author:** ![RafaelPalomar](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rafaelpalomar/32/1436_2.png) [@RafaelPalomar](https://discourse.slicer.org/u/RafaelPalomar)\
**Post date:** [September 21, 2021, 7:16pm UTC](https://discourse.slicer.org/t/module-pythonqt-qslicermarkupsmodulewidgets-has-no-attribute-qmrmlmarkupsroiwidget/19675/8 "2021-09-21T19:16:49Z")

</div>

Thank you @jumbojing, @jamesobutler and @lassoan for reporting and giving insight on this issue. Here are my findings on this issue.

The idea behind `qSlicerMarkupsROIWidget` (as well as other qSlicerMarkups widgets) was to make it an “optional” widget that will show only when the relevant markup is selected. This avoids filling up the Markups module interface with widgets unusable in the context of the current markup (e.g., a ROI widget does not make sense for a line markup).

Much of this behavior is driven by the `qSlicerMarkupsROIWidget` itself (e.g., here the widget is set invisible by default [Slicer/qSlicerMarkupsROIWidget.cxx at 022a4f1a347ebb24509a50f6c8928ae26d3c5955 · Slicer/Slicer · GitHub](https://github.com/Slicer/Slicer/blob/022a4f1a347ebb24509a50f6c8928ae26d3c5955/Modules/Loadable/Markups/Widgets/qSlicerMarkupsROIWidget.cxx#L72)), which makes it less usable as an independent component. I think it is possible to translate the coordination of this behavior up to `qSlicerMarkupsModuleWidget` widget and leave `qSlicerMarkupsROIWidget` as a more independent component. @lassoan, @jamesobutler, let me know your thoughts on this approach; I think I can handle this in the coming days, before the release of Slicer5.

---

<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 21, 2021, 10:06pm UTC](https://discourse.slicer.org/t/module-pythonqt-qslicermarkupsmodulewidgets-has-no-attribute-qmrmlmarkupsroiwidget/19675/9 "2021-09-21T22:06:39Z")

</div>

Adding markups option widgets is good. But these widgets should not replace the reusable high-level widgets, but they should show one or more of these high-level widgets.

---

<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 22, 2021, 12:38am UTC](https://discourse.slicer.org/t/module-pythonqt-qslicermarkupsmodulewidgets-has-no-attribute-qmrmlmarkupsroiwidget/19675/10 "2021-09-22T00:38:23Z")

</div>

A post was split to a new topic: [Get oriented bounding boxes for each segment](https://discourse.slicer.org/t/get-oriented-bounding-boxes-for-each-segment/19796)

---

<div class="post-metadata">

**Author:** ![RafaelPalomar](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rafaelpalomar/32/1436_2.png) [@RafaelPalomar](https://discourse.slicer.org/u/RafaelPalomar)\
**Post date:** [September 30, 2021, 7:42pm UTC](https://discourse.slicer.org/t/module-pythonqt-qslicermarkupsmodulewidgets-has-no-attribute-qmrmlmarkupsroiwidget/19675/12 "2021-09-30T19:42:43Z")

</div>

There is a PR ([Refactor markups qt widgets by RafaelPalomar · Pull Request #5921 · Slicer/Slicer · GitHub](https://github.com/Slicer/Slicer/pull/5921)) on this now.
