# How to detect if a GLMakie window is closed?

**URL:** <https://discourse.julialang.org/t/how-to-detect-if-a-glmakie-window-is-closed/111933>\
**Category:** Visualization\
**Tags:** question, package, glmakie\
**Created:** [March 21, 2024, 1:43pm UTC](https://discourse.julialang.org/t/how-to-detect-if-a-glmakie-window-is-closed/111933 "2024-03-21T13:43:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [March 21, 2024, 1:43pm UTC](https://discourse.julialang.org/t/how-to-detect-if-a-glmakie-window-is-closed/111933/1 "2024-03-21T13:43:14Z")

</div>

When I start my program, I open an GLMakie window. How can I detect if the window is still open or if it was closed by the user? Is there an `on_close()` event?

I want to stop my simulation when the user closes the window. In the moment the user has to press \<ctrl\>\<c\> to stop the simulation after closing the window which is not nice…

---

<div class="post-metadata">

**Author:** ![xiaoming](https://avatars.discourse-cdn.com/v4/letter/x/a6a055/32.png) [@xiaoming](https://discourse.julialang.org/u/xiaoming)\
**Post date:** [March 21, 2024, 2:15pm UTC](https://discourse.julialang.org/t/how-to-detect-if-a-glmakie-window-is-closed/111933/2 "2024-03-21T14:15:51Z")

</div>

You can try `isopen(fig.scene)`.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [March 21, 2024, 2:19pm UTC](https://discourse.julialang.org/t/how-to-detect-if-a-glmakie-window-is-closed/111933/3 "2024-03-21T14:19:12Z")

</div>

Thanks, this works!
