is there any way to debug wx.html2.webview? I am not able to find its source code, I will appreciate any help about it.
Its source code is in wxWidgets (C++). Which operating system are you
using?
Scott
Win 7 and Win 10. Is there a way to debug it from Python or not? I use also wxWidgets in C++ but I did not use webview in C++, this is the 1st time and I have to use it in Python.
Hi,
Have you tried InspectionTool? That’s easy and powerful! You only need to add a few lines in your code as follows.
import wx
import wx.html2
if __name__ == '__main__':
app = wx.App()
frm = wx.Frame(None)
browser = wx.html2.WebView.New(frm)
browser.LoadURL("https://www.google.com")
if 1:
from wx.lib.inspection import InspectionTool
it = InspectionTool()
it.Show()
frm.Show()
app.MainLoop()
To watch the WebViewEvent while navigating and inspect/debug the target in the InspectionTool,
- Select the target in the Widget Tree =>
~/Frame/WebView
. - Press the [Events] button.
- Then, press [Add Module] and input
wx.html2
in the dialog box. - Type
obj
in Pycrust to access the target object.
For example,
>>> obj
<wx._html2.WebView object at 0x000002C36C0B18B0>
>>> obj.DoSomething()
Something happens.