Hi Robin, et al,
I'm running into an issue that I'd like to understand better. Using
the new wx.html2 in wxPython 2.9.3.1, I found that it does not work in
the context of a wx.Dialog and only works in wx.Frame on OSX. What it
does is it will issue the EVT_WEB_VIEW_NAVIGATING but thats as far as
it goes and it shows only a blank white page. This can be an issue if
I need the UI to suspend execution until the browser is closed.
Here is a simple script that will demonstrate this. You can see if
you use the Show() method, the URL will get loaded properly, but the
ShowModal() one fails. Has anyone else encountered this? I'm curious
to hear solutions/fixes/etc.
Thanks!
import wx
import wx.html2
class MyBrowser(wx.Dialog):
def __init__(self, *args, **kwds):
wx.Dialog.__init__(self, *args, **kwds)
sizer = wx.BoxSizer(wx.VERTICAL)
self.browser =
wx.html2.WebView.New(self)
sizer.Add(self.browser, 1, wx.EXPAND, 10)
self.SetSizer(sizer)
self.SetSize((700, 700))
if __name__ == '__main__':
app = wx.PySimpleApp()
dialog = MyBrowser(None, -1)
dialog.browser.LoadURL("
http://www.google.com")
# Does not
work:
#dialog.Show()
#dialog.Destroy()
# Does work, but you need to suspend execution
somehow:
dialog.Show()
app.MainLoop()