webview.start() function
See original GitHub issueI propose an alternative way to start a webview application
webview.start(title, html, css='', script='', js_api=None, options={})
would start a webview window with the given title and html. Optionally separate CSS and JS can be supplied as parameters (or embedded into the html). options
would be a new dictionary with window specific options of create_window
. start
would be a single window blocking function, subsequent windows shall be opened using create_window
.
All the building blocks are already in place, so the implementation should pose no challenges.
Comments are welcomed.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:8 (5 by maintainers)
Top Results From Across the Web
API | pywebview
webview. Start a GUI loop and display previously created windows. This function must be called from a main thread.
Read more >webview.util.WebViewException: This function must be run ...
I am creating these to thread in my python program but they don't start , it says run then from main thread. i...
Read more >WebView - Android Developers
Classes. ConversationStatus · ConversationStatus.Builder · PeopleManager. android.app.role. Overview. Classes. RoleManager. android.app.sdksandbox.
Read more >Android WebView Example Tutorial - DigitalOcean
The onKeyDown() method has been overridden with an implementation that first checks if the WebView can go back. If the user has navigated...
Read more >API | pywebview
Calling this function for the first time will start the application and block ... uid is the uid of the target window returned...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Agreed. What I suggest is to merge the
base_uri
andtransform_url
functions into one; The later already does the protocol check, the former properly adds the path. The new function can be used by bothcreate_window
andload_html
.But about
start
it has occurred to me that this is in fact the best time for such a drastic change! What, other than a major release like 2.0, can be the best place to put it? 3.0 would be too late. I know, I said it, it’d be work. But I don’t think it would complicate the API; instead simplify it, if we do it properly. Here’s my idea:create_window
open windows only if we’re running; if we’re not running, we will postpone the call tillstart
. I am imagining a global stack to whichcreate_window
pushes the ‘calls’ (store the window-specs) andstart
would execute one by one.start
would not take any arguments. It would return nothing also. It has to be called from the main thread and it will block. Allcreate_window
calls, before or afterstart
, will not block, but return the uid of the window._webview_ready
.start
will_initialize_imports
.Now what all this means for the single-window app maker is just an extra call to
start
after their usualcreate_window
:It would in no way complicate the API! It complicates our lives, of course. 🙃 I say do it now before the core code gets messier. I dare give it at least a try before 2.0. Another (not so attractive) option is to release a 1.9 with what we have now, and 2.0 later, with the task list mentioned in #197 including
start
.Now that’s much better, the two initial suggestions seemed far-fetched. But now how does
start
differ anyway fromcreate_window
? If we don’t want any options, both syntaxes are the same, which kind of defeats the purpose of introducingstart
, right?Before this issue was opened, I had envisioned a
start
function but with a different objective: to actually start the application. Like therun
function of most web-server frameworks. You can create all the windows you need withcreate_window
andstart
your app when you’re done. Socreate_window
would never block execution, and return theuid
s of all windows. To quote:I had got this idea when I wrote the doc for multiple windows, realising how odd it was with only the initial call to
create_window
blocking and giving a specialuid
“master” to it and all that stuff. But I restrained from proposing it as implementing such a model would render us backward-incompatible. It would be also much work. But honestly now, that would have been a better purpose for thestart
function.