Пример #1
0
 def OnClose(self, event):
     # Remember to destroy all CEF browser references before calling
     # Destroy(), so that browser closes cleanly. In this specific
     # example there are no references kept, but keep this in mind
     # for the future.
     self.Destroy()
     # On Mac the code after app.MainLoop() never executes, so
     # need to call CEF shutdown here.
     if platform.system() == "Darwin":
         chrome.Shutdown()
         wx.GetApp().Exit()
Пример #2
0
    def OnClose(self, event):
        self.Destroy()


class CustomNavigationBar(chrome.NavigationBar):
    def _LayoutComponents(self):
        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(self.url, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL,
                  12)

        sizer.Add(self.GetBackButton(), 0,
                  wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 0)
        sizer.Add(self.GetForwardButton(), 0,
                  wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 0)
        # in this example we dont want reload button
        self.GetReloadButton().Hide()
        self.SetSizer(sizer)
        self.Fit()


if __name__ == '__main__':
    chrome.Initialize()
    print('sample3.py: wx.version=%s' % wx.version())
    app = wx.PySimpleApp()
    MainFrame().Show()
    app.MainLoop()
    # Important: do the wx cleanup before calling Shutdown.
    del app
    chrome.Shutdown()