# Module 'JupyterNotebooksLib' has no attribute 'AppWindow'

**URL:** <https://discourse.slicer.org/t/module-jupyternotebookslib-has-no-attribute-appwindow/11899>\
**Category:** Support\
**Created:** [June 6, 2020, 1:55pm UTC](https://discourse.slicer.org/t/module-jupyternotebookslib-has-no-attribute-appwindow/11899 "2020-06-06T13:55:20Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vinny](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/vinny/32/7052_2.png) [@Vinny](https://discourse.slicer.org/u/Vinny)\
**Post date:** [June 6, 2020, 1:55pm UTC](https://discourse.slicer.org/t/module-jupyternotebookslib-has-no-attribute-appwindow/11899/1 "2020-06-06T13:55:20Z")

</div>

Hi,

I’m interested in the newly developed feature of displaying Slicer output within Jupyter and have downloaded the Slicer jupyter notebook tutorials from… [https://mybinder.org/v2/gh/lassoan/SlicerNotebooks/master](https://mybinder.org/v2/gh/lassoan/SlicerNotebooks/master)

However, I get the following error message after running the first cell:

* * *

AttributeError Traceback (most recent call last)  
In [1]:  
Line 4:

## AttributeError: module ‘JupyterNotebooksLib’ has no attribute ‘AppWindow’

I can however load volumes within Jupyter and display them:

[success, loadedVolumeNode] = slicer.util.loadVolume(’/home/vinny/temp\_data/test/t1.nii’, returnNode=True)

slicernb.ViewDisplay(“OneUpRedSlice”)

Slicer preview release 4.11.0-2020-06-05  
OS: Ubuntu 20.04.

Thanks for your help,

Vinny

---

<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 6, 2020, 2:46pm UTC](https://discourse.slicer.org/t/module-jupyternotebookslib-has-no-attribute-appwindow/11899/2 "2020-06-06T14:46:24Z")

</div>

Have you completed all [installation step](https://github.com/Slicer/SlicerJupyter/blob/master/README.md#setup)? In particular, have you installed ipywidgets in Slicer?

---

<div class="post-metadata">

**Author:** ![Vinny](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/vinny/32/7052_2.png) [@Vinny](https://discourse.slicer.org/u/Vinny)\
**Post date:** [June 6, 2020, 3:31pm UTC](https://discourse.slicer.org/t/module-jupyternotebookslib-has-no-attribute-appwindow/11899/3 "2020-06-06T15:31:57Z")

</div>

Hi Andras,

Thanks for the link. I followed the instructions (including installing ipywidgets) and no longer get the error message regarding a missing AppWindow. However, the output doesn’t appear to be scaled to 0.5 similar to what is in the tutorial. If I change the scaling factor, the window size does not change. Is there anything else I missed?

---

<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 6, 2020, 3:34pm UTC](https://discourse.slicer.org/t/module-jupyternotebookslib-has-no-attribute-appwindow/11899/4 "2020-06-06T15:34:45Z")

</div>

Does it work if you set the main window width and height directly?

> <https://github.com/Slicer/SlicerJupyter/blob/master/JupyterNotebooks/JupyterNotebooksLib/widgets.py#L159>

---

<div class="post-metadata">

**Author:** ![Vinny](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/vinny/32/7052_2.png) [@Vinny](https://discourse.slicer.org/u/Vinny)\
**Post date:** [June 6, 2020, 3:50pm UTC](https://discourse.slicer.org/t/module-jupyternotebookslib-has-no-attribute-appwindow/11899/5 "2020-06-06T15:50:44Z")

</div>

If I interpreted it correctly, I changed the width and height as follows:

slicernb.AppWindow.setWindowSize(width=500,height=100)

but the height and width have not changed in the output.

Initially during the installation, a message appeared stating ipywidgets 7.0.0 was not compatible with ipycanvas. So I had upgraded it within Slicer to ipywidgets 7.5.1.

---

<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 6, 2020, 5:08pm UTC](https://discourse.slicer.org/t/module-jupyternotebookslib-has-no-attribute-appwindow/11899/6 "2020-06-06T17:08:20Z")

</div>

If you execute `slicer.util.mainWindow().size = qt.QSize(width, height)` then does your main window size change? Maybe the window is maximized? We should then add a call before setting the window size to set normal window state.

---

<div class="post-metadata">

**Author:** ![Vinny](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/vinny/32/7052_2.png) [@Vinny](https://discourse.slicer.org/u/Vinny)\
**Post date:** [June 6, 2020, 6:01pm UTC](https://discourse.slicer.org/t/module-jupyternotebookslib-has-no-attribute-appwindow/11899/7 "2020-06-06T18:01:51Z")

</div>

Thanks, I tried your suggestion but the window size still looks maximized. Please see attached screenshot…perhaps I’m not calling the function properly?

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/7/57ebbf645fd95307291957e631c216f551e481fd.png)

---

<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 6, 2020, 6:04pm UTC](https://discourse.slicer.org/t/module-jupyternotebookslib-has-no-attribute-appwindow/11899/8 "2020-06-06T18:04:01Z")

</div>

Does size change work if you call `slicer.util.mainWindow().showNormal()` before?

---

<div class="post-metadata">

**Author:** ![Vinny](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/vinny/32/7052_2.png) [@Vinny](https://discourse.slicer.org/u/Vinny)\
**Post date:** [June 6, 2020, 6:11pm UTC](https://discourse.slicer.org/t/module-jupyternotebookslib-has-no-attribute-appwindow/11899/9 "2020-06-06T18:11:53Z")

</div>

Thanks Andras, that does the job! If the call is placed for example:

slicer.util.mainWindow().showNormal()  
slicer.util.mainWindow().size = qt.QSize(1200,1200)

Then when the width and height are changed, the window size changes.

With the tutorial set, adding in slicer.util.mainWindow().showNormal() before the slicernb.AppWindow.setWindowSize(scale=0.5) does the job too.

---

<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 6, 2020, 6:52pm UTC](https://discourse.slicer.org/t/module-jupyternotebookslib-has-no-attribute-appwindow/11899/10 "2020-06-06T18:52:53Z")

</div>

Thanks for testing, I’ve pushed a [fix](https://github.com/Slicer/SlicerJupyter/commit/56dc86d67214d2ecccd6a569b41f30f7e1709f01) to SlicerJupyter.

---

<div class="post-metadata">

**Author:** ![Vinny](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/vinny/32/7052_2.png) [@Vinny](https://discourse.slicer.org/u/Vinny)\
**Post date:** [June 6, 2020, 9:13pm UTC](https://discourse.slicer.org/t/module-jupyternotebookslib-has-no-attribute-appwindow/11899/11 "2020-06-06T21:13:28Z")

</div>

Thanks for pushing the fix. How can I install the latest SlicerJupyter extension with this fix? I uninstalled the SlicerJupyter extension and re-installed it. But the window size still does not change.

---

<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 6, 2020, 9:19pm UTC](https://discourse.slicer.org/t/module-jupyternotebookslib-has-no-attribute-appwindow/11899/12 "2020-06-06T21:19:57Z")

</div>

Extensions are rebuilt nightly (for each new Preview Release and the latest Stable Release), so you can either wait for that or update the modified .py file on your computer.

---

<div class="post-metadata">

**Author:** ![Vinny](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/vinny/32/7052_2.png) [@Vinny](https://discourse.slicer.org/u/Vinny)\
**Post date:** [June 7, 2020, 12:23pm UTC](https://discourse.slicer.org/t/module-jupyternotebookslib-has-no-attribute-appwindow/11899/13 "2020-06-07T12:23:23Z")

</div>

Thanks Andras for your help. Just downloaded and installed the latest preview release (Version 4.11.0; 2020-06-06; revision 29114) and it works now.
