我正在尝试将 https url 加载到 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()
有没有办法在 HTMLWindow 中加载 ssl 页面(或者其他一些在 wxWindow 中呈现 ssl 页面的方式)?
我正在使用 wx 2.8.10,目前升级不是一个真正的选择
请您参考如下方法:
您可以使用现有方法(如 urllib2.urlopen)下载文件,并将文件保存到文件系统,然后将该文件名传递给 HtmlWindow 的 LoadPage 方法。
以下 StackOverflow 问题涵盖了现有方法的示例,HTTPS connection Python 和 How do I download a file over HTTP using Python?
其他更复杂的选项涉及使用 wxIE 和 wxMozilla,一旦您下载或编译了 Python 绑定(bind)。
