user3313622
user3313622

Reputation: 5

How to use Google Chrome as browser in wxpython instead of import wx.lib.iewin

I'm developing a GUI interface using wxpython and I need to load web sites from searches in my GUI using Google Chrome.

I've found the library wx.lib.iewin which makes use of Internet Explorer in the following code:

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.mx/maps")
  dialog.Show()
  app.MainLoop()

Is it a similar library and / or call using Google Chrome instead of IE?

Thanks a lot.

Upvotes: 0

Views: 1026

Answers (1)

RobinDunn
RobinDunn

Reputation: 6306

No, that module uses ActiveX to embed the IE browser, but Chrome does not provide an ActiveX control as far as I know.

One possibility would be to use the Chromium Embedded Framework, and the cefpython bindings. I've not used it myself so I do not know how well it works, but there are examples of using it with wxPython. https://github.com/cztomczak/cefpython

Upvotes: 1

Related Questions