trap the Newwindow2 event on wxPython with IE ActiveX

oyster lepto.python at gmail.com
Mon Jan 16 03:49:15 EST 2006


Hi, everyone. I work on windows os and want to write a IE based webbrowser.

For I find that the only method which can handle most of the HTML standard
is to embed IE object, I want to change demo\wxIEHtmlWin.py (from old
wxPython) into a kind of multi-tab webbrowser( like greenbrowser, maxthon).
Now the question is: how can I deal with the NewWindow2 Event? How can I get
the url when a new window is to be created, and display this webpage in my
app other than a new IE? That is to say:

        self.ie = wxPython.iewin.wxIEHtmlWin(self, -1)
        wxPython.iewin.EVT MSHTML NEWWINDOW2(self, -1, self.OnNewWindow2)

     def OnNewWindow2(self, evt):
                #how to program here?


The artilce on http://support.microsoft.com/kb/q184876/ describes "How To
Use the WebBrowser Control NewWindow2 Event" in VB as

Private Sub WebBrowser1_NewWindow2(ppDisp As Object,
                                   Cancel As Boolean)
   Dim frmWB As Form1
   Set frmWB = New Form1

   frmWB.WebBrowser1.RegisterAsBrowser = TRUE

   Set ppDisp = frmWB.WebBrowser1.Object
   frmWB.Visible = True
End Sub


Since except "self", OnNewWindow2 only need one extra parameter other that
2, I donno how to change this code into python one?

Because I know almost nothing about VB and ActiveX, can somebody give me a
ready-to-run simple demo or demo based demo\wxIEHtmlWin.py?

Thanx in adavance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060116/1b3d00ed/attachment.html>


More information about the Python-list mailing list