-
Notifications
You must be signed in to change notification settings - Fork 15
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
examples/fig12_save_figure.nim does not automatically close the webview #50
Comments
Well, it's kind of the question what the intent is supposed to be for an example. The main problem with saving plots (regardless of browser or webview) is that we need to open some instance to execute the javascript code. Which means that if an "onlySave" option is wanted, there's no way around opening a webview window shortly anyways. I've tried for hours to find a solution for that with no success. For travis though I implemented it just such a way and nowadays it's also exposed for the webview target via the tl;dr: for the example it's intended behavior, in your own code using webview use the |
Thanks, I understand that a webview window is required for now! What I was trying to point out is that the webview window is not automatically closed, as suggested in this comment: This also causes the call to |
I just tested it on my Ubuntu 18.04 box and it did automatically close the Webview. It only saves and closes if the |
Yeah, I didn't actually look at the example 12 and forgot that it actually uses As to why closing (apparently on MacOSX) does not work, I don't know. Since I don't have a Mac around it's hard to test. |
Hmm, I just realized what appears to be happening. Or rather does not happen. I have no clue however, why |
Ok, digging into the
For me on Linux I can fix this by replacing https://github.com/zserge/webview/blob/master/webview.h#L482 with: WEBVIEW_API void webview_exit(struct webview *w) {
gtk_widget_destroy(w->priv.window);
(void)w;
} which then actually does close the window upon the call. The relevant portion for OSX btw is: |
Running
nim c -r -d:webview --threads:on -d:debug examples/fig12_save_figure.nim
produces
The webview is created with the plot, but the program hangs here and the webview is never closed. The correct output file is produced, however.
The text was updated successfully, but these errors were encountered: