wxPython 嵌入html頁面
阿新 • • 發佈:2018-09-02
log loop dial url ml2 rgs baidu sel pytho
#codeing=utf-8 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.App() dialog = MyBrowser(None, -1) dialog.browser.LoadURL("https://www.baidu.com/?tn=91960356_hao_pg") #加載頁面。如果是加載html字符串應該使用 dialog.browser.SetPage(html_string,"") dialog.Show() app.MainLoop()
wxPython 嵌入html頁面