Phoenix icon indicating copy to clipboard operation
Phoenix copied to clipboard

SetPage on wx.html2.WebView doesn't work after building exe with PyInstaller or Nuitka

Open bertbarabas opened this issue 3 years ago • 3 comments

Operating system: Windows 11 wxPython version & source: 4.2.0 Python version & source: 3.10.6

Description of the problem: When using wx.html2.WebView, SetPage works when running Python interactively but after building an exe either with PyInstaller or Nuitka, the widget remains blank or sometimes partially rendered.

This is true for both WEBVIEW_BACKEND_EDGE and WEBVIEW_BACKEND_IE. However when using WEBVIEW_BACKEND_IE the default allows a pop-up in the widget that has a "refresh" item. Clicking "refresh" will cause the page to render properly.

This used to work with wxPython 4.1.1.

Suggested work-arounds welcome!

Code Example (click to expand)
# Put code sample here

bertbarabas avatar Aug 14 '22 14:08 bertbarabas

As a workaround, you can modify your PyInstaller .spec file to include WebView2Loader.dll.

https://discuss.wxpython.org/t/ms-edge-backend-for-webview/34953/13 https://discuss.wxpython.org/t/ms-edge-backend-for-webview/34953/17

AlexStanglEmerson avatar Oct 07 '22 21:10 AlexStanglEmerson

Thanks! This was exactly the information I needed.

I used a slight variation. Instead of updating the spec since I was using the autogenerated spec file, I used the --add-binary command line option instead. Specifically:

--add-binary ".venv\Lib\site-packages\wx\WebView2Loader.dll;."

bertbarabas avatar Oct 09 '22 02:10 bertbarabas

Thanks very much.

lanhao945 avatar Oct 23 '23 08:10 lanhao945