# Makie scene, wait for input

**URL:** <https://discourse.julialang.org/t/makie-scene-wait-for-input/28860>\
**Category:** General Usage\
**Created:** [September 17, 2019, 7:13pm UTC](https://discourse.julialang.org/t/makie-scene-wait-for-input/28860 "2019-09-17T19:13:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BioTurboNick](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bioturbonick/32/6380_2.png) [@BioTurboNick](https://discourse.julialang.org/u/BioTurboNick)\
**Post date:** [September 17, 2019, 7:13pm UTC](https://discourse.julialang.org/t/makie-scene-wait-for-input/28860/1 "2019-09-17T19:13:36Z")

</div>

I want a loop using Makie where:

scene rendered  
user input collected  
user terminates input (keys entered, window closed)  
advances to next scene

What would I need to do to implement the wait-then-advance-on-input part? Is there something in Makie, or another package, that I could use? I’ve tried some different locking approaches but it’s not working out.

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [September 17, 2019, 9:00pm UTC](https://discourse.julialang.org/t/makie-scene-wait-for-input/28860/2 "2019-09-17T21:00:31Z")

</div>

you can just do something like:

```julia
scene = plot(...)
screen = display(scene)
on(events(scene).keyboardbuttons) do button
 if ispressed(button, Keyboard.enter)
     # do something
end
end
wait(screen) # blocks until window closed

```

Available events you can base your interactions uppon:

```julia
window_area: GeometryTypes.HyperRectangle{2,Int64}
window_dpi: Float64
window_open: Bool
mousebuttons: Set{AbstractPlotting.Mouse.Button}
mouseposition: Tuple{Float64,Float64}
mousedrag: AbstractPlotting.Mouse.DragEnum
scroll: Tuple{Float64,Float64}
keyboardbuttons: Set{AbstractPlotting.Keyboard.Button}
unicode_input: Array{Char,1}
dropped_files: Array{String,1}
hasfocus: Bool
entered_window: Bool

```

---

<div class="post-metadata">

**Author:** ![halleysfifthinc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/halleysfifthinc/32/206280_2.png) [@halleysfifthinc](https://discourse.julialang.org/u/halleysfifthinc)\
**Post date:** [April 12, 2020, 9:17pm UTC](https://discourse.julialang.org/t/makie-scene-wait-for-input/28860/3 "2020-04-12T21:17:46Z")

</div>

Is it possible to close the window programmatically from a keyboard callback? I’m using this workflow, but I’d like to be able to close the window and move on with a keypress (‘Escape’ in this case).

I’ve tried `GLMakie.destroy!(screen)` but that doesn’t work (hangs indefinitely, and crashes if i try to `return` after destroying the screen.

---

<div class="post-metadata">

**Author:** ![asinghvi17](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/asinghvi17/32/8272_2.png) [@asinghvi17](https://discourse.julialang.org/u/asinghvi17)\
**Post date:** [April 29, 2020, 4:51am UTC](https://discourse.julialang.org/t/makie-scene-wait-for-input/28860/4 "2020-04-29T04:51:31Z")

</div>

Might be worth an issue if this is still the case.
