r0x0r / pywebview

Build GUI for your Python program with JavaScript, HTML, and CSS
https://pywebview.flowrl.com
BSD 3-Clause "New" or "Revised" License
4.63k stars 537 forks source link

raise WebViewException('Main window failed to load') #653

Closed tarquo23 closed 3 years ago

tarquo23 commented 3 years ago

Specification

Description

Hi, I'm working on my thesis project for neurological experiments. So far I have used Tkinter to build a desktop application and start from it some experiments using Psychopy. Now I would need to display some web pages inside my application to give the user instructions on how to move around the page. So I decided to use your library to open a webpage within my application. I don't know if this is not possible but when I launch the code below, web = webview.create_window('Experiment', 'https://www.nespresso.com/it/it/our-choices/esperienza-caffe/lean-in-and-listen-stories-behind-nespresso-fairtrade-coffee') webview.start() the application crashes and I get the following output. Am I doing something wrong or just a Tkinter GUI can't live with your library?

Issue

Practicalities

r0x0r commented 3 years ago

I could not reproduce it ran as a standalone application.

I have no clue how to use pywebview from tkinter or another gui application. pywebview was not designed for that, but apparently people try to do it all the time.

tarquo23 commented 3 years ago

I guess it's because on the internet it's recommended when you ask how you can open web pages, but not when you're looking for which framework to build an application with. So the needs are discovered when a good part of the functions have already been written with other libraries, such as Tkinter.

r0x0r commented 3 years ago

One solution is to open pywebview as a separate window along with tktinter gui in another window. Here is an example of multiprocessing architecture https://github.com/r0x0r/pywebview/blob/2cff89a76fd70a621900e5e806355affc24f787d/docs/examples/no_block.md

tarquo23 commented 3 years ago

Thanks for your availability, these days I try to see if I can make it work!

Ksengine commented 3 years ago

you can run Tkinter GUI loop (root.mainloop()) in another thread

github-actions[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 3 years ago

The message to post on the issue when closing it. If none provided, will not comment when closing an issue.