Makie scene, wait for input

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.

you can just do something like:

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:

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
1 Like

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.

1 Like

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