Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blink window disappeared soon after it was opened ? #195

Closed
kailotus opened this issue Mar 30, 2019 · 8 comments
Closed

Blink window disappeared soon after it was opened ? #195

kailotus opened this issue Mar 30, 2019 · 8 comments

Comments

@kailotus
Copy link

Hello Everyone :
I used Blink to make Julia's GUI application. There is a code (BlinkApp.jl) as follows:

using Blink
w = Window()
body!(w, "Hello Blink")

When I use Julia REPL to execute:
Julia> include("BlinkApp.jl")
The Blink window can be displayed normally.

But when I use the MS Windows command prompt and give the command:
C:\Temp>julia BlinkApp.jl
I found that the window flickered and disappeared.
Has anyone ever had such a situation?
By the way, please ask how to solve this problem?
Thank you all.

@srgk26
Copy link

srgk26 commented Apr 30, 2019

@kailotus I have the same problem too. Running Blink script from the command line doesn't work, though works from Julia REPL.

@pfitzseb
Copy link
Member

You have to make sure that Julia stays alive after your script has run, e.g. by having your last statement be readline() or something like that.

@srgk26
Copy link

srgk26 commented May 2, 2019

You have to make sure that Julia stays alive after your script has run, e.g. by having your last statement be readline() or something like that.

@pfitzseb Thank you, it works. But the problem is it also causes the terminal to be hung, cos the computer is waiting for a return value from readline(), which it never gets. I am trying to build an app that uses Blink, and using this method causes the app to crash, even though the terminal executable works fine. But that's only because terminal itself is hung.

I will try to work around that. But could there be a neater way to do this?

@pfitzseb
Copy link
Member

pfitzseb commented May 2, 2019

I mean you could also try to spawn another Julia process that stays alive even if the explicitly started one dies, but this is fairly standard behaviour.

@twavv
Copy link
Member

twavv commented Jul 30, 2019

We should probably add a waitclosed-type function that blocks until the Window is closed (so that cleanup tasks can be performed). This would allow you to just include waitclosed(w) at the end of a Julia file to keep things open.

@twavv twavv closed this as completed Jul 30, 2019
@mlhetland
Copy link

Is there an issue that relates to this waitclosed-type function, or has something like it been added? (If not, I guess you could reopen this issue as a placeholder?) Currently, the best solution I've found (cf. this Discourse post) for using Blink.jl in a script (and not the REPL) is:

while active(w)
    sleep(1)
end

Is there a more idiomatic way of doing this, at present?

@sina-masoud-ansari
Copy link

I had a similar issue with getting Interact.jl to work with Mux.jl from a script. One way to resolve the issue is to add the following to the end of the script:

Base.JLOptions().isinteractive==0 && wait()

Source: JuliaWeb/Mux.jl#73

waitclosed would be preferred though to allow cleanup as mentioned already.

@twavv
Copy link
Member

twavv commented Apr 7, 2020

#254

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants