The below code opens up a url in a pywebview window
window = webview.create_window('Unreal Map Bridge', url='https://map.justgeektechs.com', height=height, width=width)
window.events.closed += on_closed
webview.start(func=custom_logic, args=window, debug=True, private_mode=False)
I want the user to be able to right click and access the normal right click context menu and debug tools for browsers. This only works if debug=True but the problem is that it automatically opens a new popup window of the DevTools. Is there a way to prevent the automatic open of the DevTools window will still enabling access to dev tools and browser context menu. Or another option is to automatically close the pop DevTools window. I tried but pywebview does not have access to the browser javascript api as in browser.windows.getAll().
The hidden dev tools option is planned as a new feature of upcoming pywebview 5.0 release.
But I don't know how to install this 5.0 dev branch.
However, for Linux/GTK a one-line change in
gtk.pyseems to disable it in the current 4.4.1 version:In my installation, the file
gtk.pyis at$HOME/.local/lib/python3.11/site-packages/webview/platforms/gtk.py.Note: Of course, it's better to wait for the official 5.0 release, and it's a very bad practice to change random lines in local pip-packages. But for me this quick-and-dirty hack works ok for now, no crashes or something. Right-click context menu works. Inspector works. Don't use it in production, please.