# How to hide the main window until my module is loaded

**URL:** https://discourse.slicer.org/t/how-to-hide-the-main-window-until-my-module-is-loaded/25810
**Category:** Development
**Created:** [October 20, 2022, 1:57pm UTC](https://discourse.slicer.org/t/how-to-hide-the-main-window-until-my-module-is-loaded/25810 "2022-10-20T13:57:00Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Corain](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/corain/32/14846_2.png) [@Corain](https://discourse.slicer.org/u/Corain)
#### Post date: [October 20, 2022, 1:57pm UTC](https://discourse.slicer.org/t/how-to-hide-the-main-window-until-my-module-is-loaded/25810/1 "2022-10-20T13:57:00Z")

</div>

Operating system: Win 10  
Slicer version: Slicer 5.0.3  
Expected behavior: Directly show the GUI of my module when I open MyModule.exe.  
Actual behavior: It will show the Slicer welcome page for a second first and then jump to my GUI.

I write a module with its own interface for my project referring to the QuickSegment Slicelet example. And I clone the .exe and .ini files as stated [here](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Slicelets) so I can open my module by MyModule.exe. The problem is when I open it the original Slicer GUI will show first and then automatically switch to my GUI.

Is there a way to prevent the Slicer GUI from showing? Or can I hide the main window as default and then call mainWindow.show() in my module?

Thank you!

---

<div class="post-metadata">

### Author: ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)
#### Post date: [October 20, 2022, 3:07pm UTC](https://discourse.slicer.org/t/how-to-hide-the-main-window-until-my-module-is-loaded/25810/2 "2022-10-20T15:07:19Z")

</div>

You could play with the `--no-main-window` launcher option and see if you can display it again when your module is initialized.

However, you may want to look into [Slicer Custom Apps](https://github.com/KitwareMedical/SlicerCustomAppTemplate). All you need to do is generate your custom app skeleton with the cookie cutter, add your module and set it as home module. Then you’ll have more control about the application.

---

<div class="post-metadata">

### Author: ![Corain](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/corain/32/14846_2.png) [@Corain](https://discourse.slicer.org/u/Corain)
#### Post date: [October 20, 2022, 4:13pm UTC](https://discourse.slicer.org/t/how-to-hide-the-main-window-until-my-module-is-loaded/25810/3 "2022-10-20T16:13:04Z")

</div>

Thanks for your reply! The --no-main-window option doesn’t work because I cannot launch my module without the main window. I will try the Slicer Custom Apps.

---

<div class="post-metadata">

### Author: ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)
#### Post date: [October 21, 2022, 7:38am UTC](https://discourse.slicer.org/t/how-to-hide-the-main-window-until-my-module-is-loaded/25810/4 "2022-10-21T07:38:21Z")

</div>

Yes this is why I used the word “play” with the option. When your module is up and its setup is called, you could try changing some setting of the main window then showing it for a moment before you hide it again… But the custom app is the hack-free way.
