-
-
Notifications
You must be signed in to change notification settings - Fork 695
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
WebView widget does not load with Windows Store Python #2752
Comments
Thanks for the report; unfortunately, I can't reproduce this problem. If you're not receiving any other errors about the availability of the Edge webview, then my best guess is that the underlying problem is a timing error in this specific example. If you click the "go" button, does it load the webpage? If so, then the issue could be that the webview is working, but the order of page loads is getting confused. The webview is originally being created with no initial URL; and that (empty) page is loading successfully, but because there's a load in progress, the subsequent URL change is being lost. |
@freakboy3742 I add a print message in the load_page function, when click the "go" button, it will print, but no webview display. |
This suggests the issue might be layout. If you add a widget (say, a toga.Label) to the column box after the web view - does that widget appear in the GUI directly under the text input and button? If so, the webview is there, it's just being rendered as zero height, and therefore invisible - although I'm not sure why that would be happening. |
@freakboy3742 I add a test label, and repeat to click the button, but the webview widget still doesn't appear in the GUI. |
To confirm - your console log isn't showing anything errors or warnings about the web view when the app starts? |
yes, no error in the console log @freakboy3742 |
I'm at a loss - I can't work out what is going on here. The WebView2 assembly must be successfully loading, or you'd be getting errors in the console. I can only assume that the control isn't initialising - and isn't failing to initialise either, because if it was failing you'd be getting an error. You might be able to clarify this by putting some additional logging into Toga's winforms backend, on the I've done a quick search and there's some suggestions this might be related to the .NET runtime version that you have installed - what version have you got? |
@freakboy3742 I haven't install any .NET runtime before, and now I try install the dotnet-sdk-8.0.303-win-x64, but the webview widget still not works. |
I'm afraid I'm at a complete loss. As I can't reproduce your problem, it's very hard for me to investigate further. All I can suggest is that you trace through the code and try and identify what is (and isn't) happening during startup - such as tracking whether the |
@freakboy3742 I have add log in the WebView.winforms_initialization_completed, it print out RuntimeError :can not find the WebView2Loader.dll |
@Jzhenli: The "file not found" problem triggered a thought; are you using Python from the Windows Store? I was able to successfully recreate this behavior using the Windows Store Python:
@freakboy3742, does |
@rmartin16 yes, I used the python from the Windows Store. |
Thank you for the confirmation. I don't know the exact mechanism yet but Windows Store Python can do strange things with passing file paths outside of Python.
I confirmed it's the same thread. Moreover, it looks like Exceptions raised in this callback are just completely swallowed by .NET; I even tried calling |
@Jzhenli, I believe I tracked this down today; if you'd like to try out my proposed fix, you can update your [tool.briefcase.app.helloworld.windows]
requires = [
#"toga-winforms~=0.4.5",
'git+https://github.com/rmartin16/toga@webview-for-winstore-python#subdirectory=core',
'git+https://github.com/rmartin16/toga@webview-for-winstore-python#subdirectory=winforms',
] |
@rmartin16 I have download the WebView2Loader.dll and register it to the windows os, now it works well. I'm not sure if your solution have fix it, because I can't reproduce this problem, but I have tried as your suggestion, and it seems works. |
Describe the bug
Hi, I have try webview widget on win11, and it not works.
Steps to reproduce
the test code as below:
Expected behavior
webview not display as below image:

Expected: the webview should display
Screenshots
No response
Environment
Logs
Additional context
No response
The text was updated successfully, but these errors were encountered: