# Hide main window - Show only external view

**URL:** https://discourse.slicer.org/t/hide-main-window-show-only-external-view/26525
**Category:** Development
**Tags:** module, loadable-module
**Created:** [December 1, 2022, 3:01am UTC](https://discourse.slicer.org/t/hide-main-window-show-only-external-view/26525 "2022-12-01T03:01:59Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![lucas\_sd](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lucas_sd/32/17087_2.png) [@lucas\_sd](https://discourse.slicer.org/u/lucas_sd)
#### Post date: [December 1, 2022, 3:01am UTC](https://discourse.slicer.org/t/hide-main-window-show-only-external-view/26525/1 "2022-12-01T03:01:59Z")

</div>

Hi everybody,

Im running my module from the terminal using --no-main-window, and I wondering if its possible to show just an external view like [that](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#show-a-slice-view-outside-the-view-layout).

The idea is run the module from the terminal with 3dS in the back, in some moment the external view appears (necessary to put a point), then close it and continue with the rest of the process.

Thanks for your help, Lucas.

---

<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: [December 1, 2022, 3:30am UTC](https://discourse.slicer.org/t/hide-main-window-show-only-external-view/26525/2 "2022-12-01T03:30:50Z")

</div>

I would recommend to use the main window, as it makes everything much simpler (and allows you to switch back to the full Slicer GUI for testing and troubleshooting very easily).

You can hide unnecessary decoration of the window using `slicer.util.set...Visible` functions:

```python
showFull = False # set it to True to show the full Slicer GUI
slicer.util.setMenuBarsVisible(showFull)
slicer.util.setStatusBarVisible(showFull)
slicer.util.setToolbarsVisible(showFull)
slicer.util.findChild(None, "PanelDockWidget").setVisible(showFull)

```

See more information on the [Slicelet page](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Slicelets).

---

<div class="post-metadata">

### Author: ![lucas\_sd](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lucas_sd/32/17087_2.png) [@lucas\_sd](https://discourse.slicer.org/u/lucas_sd)
#### Post date: [December 2, 2022, 6:39pm UTC](https://discourse.slicer.org/t/hide-main-window-show-only-external-view/26525/3 "2022-12-02T18:39:01Z")

</div>

HI Andras, the idea is start the module from the console and open the 3dS GU just to take some points and close it.

I wonder if its possible run the process like that:

- Run my module from my terminal with 3dS --no-main-window.
- In some moment of the process the module opens 3dS GUI.
- The user take some points, and then the module closes 3dS GUI.
- The module continues with the rest.

I dont know if its possible (and how) to open and close the GUI when I started with --no-main-window.

Thanks, Lucas.

---

<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: [December 3, 2022, 5:19am UTC](https://discourse.slicer.org/t/hide-main-window-show-only-external-view/26525/4 "2022-12-03T05:19:16Z")

</div>

I don’t think you can create a main window later, but what you can do is to hide the main window right after it is created. It will just pop up for a fraction of a second. If you don’t want the main window to appear even for a very short time then I think you need to implement a custom application and change the main window initialization.

You can also keep a running Slicer in the background and just send commands to execute using web requests (executed by the WebServer module). This has the advantage that Slicer has to be started only once when the computer starts (or the first time it is needed) and it can stay hidden in the background until it is needed to display something.
