How do I wait for a Plots.jl window to be closed?

Is there something similar to plt.show(block=true) from matplotlib in Plots.jl.
I would prefer a solution for the GR backend.
Maybe a call which is waiting for all windows / gui threads to be closed?

using Plots
p=plot(rand(10));
gui(p)
# somehow wait here for the gui to be closed
println("everything is closed")

I do it like this (in GR)

using Plots
f(x) = x^2
x = collect(-10:10)
y = f.(x)
println(y)
p = plot(x, y, label=false, lw=1.0)
title!("f(x) = x^2")
display(p)
println("\npress enter to close plot")
readline()
1 Like

This is a nice solution when the terminal is available. In my case a background process is started to execute the Julia code. Therefore I don’t have access to terminal inputs such as readline.