By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,589 Members | 1,026 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,589 IT Pros & Developers. It's quick & easy.

Integrate IE in python program

P: 19
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 !
Aug 23 '07 #1
Share this Question
Share on Google+
7 Replies

ilikepython
Expert 100+
P: 844
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.
Aug 23 '07 #2

bartonc
Expert 5K+
P: 6,596
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.
Aug 23 '07 #3

P: 19
I have found something about IEHtmlWindow
And I have tried to write something but everything crash
My code
Expand|Select|Wrap|Line Numbers
  1. import wx
  2. if wx.Platform == '__WXMSW__':
  3.     import  wx.lib.iewin    as  iewin
  4.  
  5. class IE(wx.Frame):
  6.     def __init__(self,titre):
  7.         wx.Frame.__init__(self,parent=None, id=-1, title= titre , size=(300, 300) )
  8.  
  9.         self.ie = iewin.IEHtmlWindow(self, id=-1, style = wx.NO_FULL_REPAINT_ON_RESIZE )
  10.         self.current = "http://localhost/"
  11.         self.ie.LoadUrl(self.current)
  12.         return True
  13.  
  14. class Monpp(wx.App):
  15.     def OnInit(self):
  16.         fen = IE("zone")
  17.         fen.Show(True)
  18.         self.SetTopWindow(fen)
  19.         return True
  20.  
  21. app = Monpp()
  22. app.MainLoop()
  23.  
Thanks !
Aug 23 '07 #4

bartonc
Expert 5K+
P: 6,596
Good one! iewin is a special subclass of an ActiveX window. This (modified slightly) works on my system. You do have wxPython, then???
Expand|Select|Wrap|Line Numbers
  1. import wx
  2. if wx.Platform == '__WXMSW__':
  3.     import  wx.lib.iewin    as  iewin
  4.  
  5. class IE(wx.Frame):
  6.     def __init__(self,titre):
  7.         wx.Frame.__init__(self,parent=None, id=-1, title= titre , size=(300, 300) )
  8.  
  9.         self.ie = iewin.IEHtmlWindow(self, id=-1, style = wx.NO_FULL_REPAINT_ON_RESIZE )
  10.         self.current = "http://google.com/"  ### localhost ## won't work!!!
  11.         self.ie.LoadUrl(self.current)
  12.         return True
  13.  
  14. class Monpp(wx.App):
  15.     def OnInit(self):
  16.         fen = IE("zone")
  17.         fen.Show(True)
  18.         self.SetTopWindow(fen)
  19. ##        return True   ## Don't return a value here!!!
  20.  
  21. app = Monpp()
  22. app.MainLoop()
Aug 24 '07 #5

P: 19
I changed my code so I have already the same errors:
Traceback (most recent call last):
File "D:\aaa\barre\test.py", line 20, in <module>
app = Monpp()
File "C:\Program Files\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 7819, in __init__
self._BootstrapApp()
File "C:\Program Files\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 7416, in _BootstrapApp
return _core_.PyApp__BootstrapApp(*args, **kwargs)
File "D:\aaa\barre\test.py", line 16, in OnInit
fen = IE("zone")
TypeError: __init__() should return None, not 'bool'
Aug 24 '07 #6

bartonc
Expert 5K+
P: 6,596
I changed my code so I have already the same errors:
You mean you copied my post and all the errors went away, right?
Aug 24 '07 #7

P: 19
Before the change i had the same error
Aug 24 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.