import wx import wx.html2 class MainFrame(wx.Frame): def __init__(self, parent): super(MainFrame, self).__init__(parent) self.InitUI() self.InitLayout() def InitUI(self): self.SetSize((800,600)) self.address = wx.TextCtrl(self) self.goButton = wx.Button(self, label='Go') self.goButton.Bind(wx.EVT_BUTTON, self.onClickGoButton) self.browser = wx.html2.WebView.New(self) self.browser.Bind(wx.html2.EVT_WEBVIEW_NAVIGATING, self.onWebViewNavigating) self.browser. self.toolBar = self.CreateToolBar(wx.TB_HORIZONTAL, wx.ID_ANY) self.backTool = self.toolBar.AddTool(1001, 'Vissza', wx.Bitmap('back.png')) self.Bind(wx.EVT_TOOL, self.onClickBackTool, self.backTool) self.toolBar.Realize() def InitLayout(self): rootBox = wx.BoxSizer(wx.VERTICAL) headBox = wx.BoxSizer(wx.HORIZONTAL) workBox = wx.BoxSizer(wx.HORIZONTAL) rootBox.Add(headBox, 0, wx.EXPAND) rootBox.Add(workBox, 1, wx.EXPAND) headBox.Add(self.address, 1) headBox.Add(self.goButton, 0) workBox.Add(self.browser, -1, wx.EXPAND | wx.ALL, 5) self.SetSizer(rootBox) def onClickGoButton(self, event): self.browser.LoadURL(self.address.GetValue()) def onWebViewNavigating(self, event): url = event.GetURL() print(url) def onClickBackTool(self, event): self.browser.GoBack()