Search code examples
pythonsslhttpswxwidgetswxhtmlwindow

loading https page into wx.html.HTMLWindow


I am trying to load a https url into an HTMLWindow

import wx
import wx.html

class MyHtmlFrame(wx.Frame):
    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, -1, title, size=(600,400))
        html = wx.html.HtmlWindow(self)
        if "gtk2" in wx.PlatformInfo:
            html.SetStandardFonts()

        wx.CallAfter(html.LoadPage, "https://www.google.com")#Fails to load page 
        #but the following works ...
        #wx.CallAfter(html.LoadPage, "http://www.google.com")#Works Fine!


app = wx.PySimpleApp()
frm = MyHtmlFrame(None, "Simple HTML Browser")
frm.Show()
app.MainLoop()

Is there a way to load a ssl page in HTMLWindow (or some other in-a-wxWindow way to render ssl pages)?

I am using wx 2.8.10 , and upgrading is not really an option currently


Solution

  • I really wanted to grant my bounty to someone but really here is the solution that lmjohns led me too ... sort of ... the solution is to use wx IEWin

    import wx
    import wx.lib.iewin as iewin
    class MyBrowser(wx.Dialog):
      def __init__(self, *args, **kwds):
        wx.Dialog.__init__(self, *args, **kwds)
        sizer = wx.BoxSizer(wx.VERTICAL)
        self.browser =  iewin.IEHtmlWindow(self)
        sizer.Add(self.browser, 1, wx.EXPAND, 10)
        self.SetSizer(sizer)
        self.SetSize((850, 730))
      def load(self,uri):
          self.browser.Navigate(uri)
    
    if __name__ == '__main__':
      app = wx.App()
      dialog = MyBrowser(None, -1)
      dialog.browser.Navigate("https://www.google.com")
      dialog.Show()
      app.MainLoop()