I have a script for an interactive plot made with GLMakie. The script works on REPL (launched via VS Code).
However, I would like to launch the script from terminal directly. Thus, I wrote a script in bash to launch the julia file. The file is launched, but the GLMakie is not displayed and then the julia script crashes.
In this example, this is the julia file (testButton.jl
):
using GLMakie
println("Starting Julia script")
xs = range(0, 10, length = 30)
ys = 0.5 .* sin.(xs)
fig = Figure()
ax = Axis(fig[1,1], title = "Example", ylabel = "Y", xlabel = "X")
sc = scatter
lines!(ax, xs, ys, linewidth = 5, color =:midnightblue)
fig[2,1] = buttongrid = GridLayout(tellwidth = false)
buttons = buttongrid[1,1] = [
Button(fig, label = "Save Figure", fontsize = 18)
]
on(buttons[1].clicks) do click
save("Test.png", fig)
end
and this is the launcher (ButtonLauncher
):
#!/usr/bin/env bash
printf "Launching test button\n"
exec julia testButton.jl
printf "Task completed\n"
exit 0
When I launch the application, I get:
$ ./ButtonLauncher
Launching test button
Starting Julia script
$
This means the script is launched (first printf
statement) but the application does not reach the end (second printf
statement). To note that I launched the Julia file with exec
to remain within the bash environment.
How can I launch an interactive plot from terminal?
Thank you