Integrate IE in python program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • analfabete
    New Member
    • Aug 2007
    • 19

    Integrate IE in python program

    Hi,
    I begin in python program and I would like to know how I can do to integrate Internet Explorer into my python program without titlebar statusbar etc... Just with the main windows (windows which show web site)
    I have already searched documention but i never find something about my problem
    Thank you !
  • ilikepython
    Recognized Expert Contributor
    • Feb 2007
    • 844

    #2
    Originally posted by analfabete
    Hi,
    I begin in python program and I would like to know how I can do to integrate Internet Explorer into my python program without titlebar statusbar etc... Just with the main windows (windows which show web site)
    I have already searched documention but i never find something about my problem
    Thank you !
    There is a webbroswer module that might do what you are looking for.

    Comment

    • bartonc
      Recognized Expert Expert
      • Sep 2006
      • 6478

      #3
      Originally posted by analfabete
      Hi,
      I begin in python program and I would like to know how I can do to integrate Internet Explorer into my python program without titlebar statusbar etc... Just with the main windows (windows which show web site)
      I have already searched documention but i never find something about my problem
      Thank you !
      You'll need a GUI toolkit that is capable of running an ActiveX component if you really want to run IE (not the best browser in the world). wxPython is such a toolkit, for example.

      Comment

      • analfabete
        New Member
        • Aug 2007
        • 19

        #4
        I have found something about IEHtmlWindow
        And I have tried to write something but everything crash
        My code
        Code:
        import wx
        if wx.Platform == '__WXMSW__':
            import  wx.lib.iewin    as  iewin
        
        class IE(wx.Frame):
            def __init__(self,titre):
                wx.Frame.__init__(self,parent=None, id=-1, title= titre , size=(300, 300) )
        
                self.ie = iewin.IEHtmlWindow(self, id=-1, style = wx.NO_FULL_REPAINT_ON_RESIZE )
                self.current = "http://localhost/"
                self.ie.LoadUrl(self.current)
                return True
        
        class Monpp(wx.App):
            def OnInit(self):
                fen = IE("zone")
                fen.Show(True)
                self.SetTopWindow(fen)
                return True
        
        app = Monpp()
        app.MainLoop()
        Thanks !

        Comment

        • bartonc
          Recognized Expert Expert
          • Sep 2006
          • 6478

          #5
          Good one! iewin is a special subclass of an ActiveX window. This (modified slightly) works on my system. You do have wxPython, then???[CODE=python]import wx
          if wx.Platform == '__WXMSW__':
          import wx.lib.iewin as iewin

          class IE(wx.Frame):
          def __init__(self,t itre):
          wx.Frame.__init __(self,parent= None, id=-1, title= titre , size=(300, 300) )

          self.ie = iewin.IEHtmlWin dow(self, id=-1, style = wx.NO_FULL_REPA INT_ON_RESIZE )
          self.current = "http://google.com/" ### localhost ## won't work!!!
          self.ie.LoadUrl (self.current)
          return True

          class Monpp(wx.App):
          def OnInit(self):
          fen = IE("zone")
          fen.Show(True)
          self.SetTopWind ow(fen)
          ## return True ## Don't return a value here!!!

          app = Monpp()
          app.MainLoop()[/CODE]

          Comment

          • analfabete
            New Member
            • Aug 2007
            • 19

            #6
            I changed my code so I have already the same errors:
            Traceback (most recent call last):
            File "D:\aaa\barre\t est.py", line 20, in <module>
            app = Monpp()
            File "C:\Program Files\Python25\ lib\site-packages\wx-2.8-msw-unicode\wx\_cor e.py", line 7819, in __init__
            self._Bootstrap App()
            File "C:\Program Files\Python25\ lib\site-packages\wx-2.8-msw-unicode\wx\_cor e.py", line 7416, in _BootstrapApp
            return _core_.PyApp__B ootstrapApp(*ar gs, **kwargs)
            File "D:\aaa\barre\t est.py", line 16, in OnInit
            fen = IE("zone")
            TypeError: __init__() should return None, not 'bool'

            Comment

            • bartonc
              Recognized Expert Expert
              • Sep 2006
              • 6478

              #7
              Originally posted by analfabete
              I changed my code so I have already the same errors:
              You mean you copied my post and all the errors went away, right?

              Comment

              • analfabete
                New Member
                • Aug 2007
                • 19

                #8
                Before the change i had the same error

                Comment

                Working...