From: "Chris Haynes" on
Per section 16.3.4 of the wxPython book, I tried the following modification
of listing 16.3

import wx
import wx.lib.iewin

class MyHtmlFrame(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, -1, title, size=(600,400))
html = wx.lib.iewin.IEHtmlWindow(self, parent, ID=-1,
pos=wx.DefaultPosition,
size=wx.DefaultSize,
style=0,
name='IEHtmlWindow')

wx.CallAfter(
html.LoadString(file('c:/home/201/c/slides.html')))

app = wx.PySimpleApp()
frm = MyHtmlFrame(None, "Simple HTML Browser")
frm.Show()
app.MainLoop()

with the following result:

Traceback (most recent call last):
File "C:\home\python\gui\wxPythonInAction-src\Chapter-16\iehtml.py", line
17, in -toplevel-
frm = MyHtmlFrame(None, "Simple HTML Browser")
File "C:\home\python\gui\wxPythonInAction-src\Chapter-16\iehtml.py", line
11, in __init__
name='IEHtmlWindow')
TypeError: __init__() got multiple values for keyword argument 'ID'

Commenting out the ID=-1 argument (don't know why this helps, since it looks
like -1 is the default)
I get:

Traceback (most recent call last):
File "C:\home\python\gui\wxPythonInAction-src\Chapter-16\iehtml.py", line
17, in -toplevel-
frm = MyHtmlFrame(None, "Simple HTML Browser")
File "C:\home\python\gui\wxPythonInAction-src\Chapter-16\iehtml.py", line
11, in __init__
name='IEHtmlWindow')
File "C:\Program
Files\Python24\lib\site-packages\wx-2.6-msw-unicode\wx\lib\iewin.py", line
117, in __init__
ID, pos, size, style, name)
File "C:\Program
Files\Python24\lib\site-packages\wx-2.6-msw-unicode\wx\activex.py", line
440, in __init__
newobj = _activex.new_IEHtmlWindowBase(*args, **kwargs)
TypeError: argument number 3: a 'number' is expected, 'NoneType(None)' is
received

The IDLE stack inspector hanges trying to display the iewin.py frame.

Help much appreciated!

Chris

From: "Richard Burton" on
Try the following:

html = wx.lib.iewin.IEHtmlWindow(self, parent, wx.ID_ANY,
pos=wx.DefaultPosition,
size=wx.DefaultSize,
style=0,
name='IEHtmlWindow')

Best Regards,

On 8/22/06, Chris Haynes <chaynes(a)indiana.edu> wrote:
>
> Per section 16.3.4 of the wxPython book, I tried the following
> modification of listing 16.3
>
> import wx
> import wx.lib.iewin
>
> class MyHtmlFrame(wx.Frame):
> def __init__(self, parent, title):
> wx.Frame.__init__(self, parent, -1, title, size=(600,400))
> html = wx.lib.iewin.IEHtmlWindow(self, parent, ID=-1,
> pos=wx.DefaultPosition,
> size=wx.DefaultSize,
> style=0,
> name='IEHtmlWindow')
>
> wx.CallAfter(
> html.LoadString(file('c:/home/201/c/slides.html')))
>
> app = wx.PySimpleApp()
> frm = MyHtmlFrame(None, "Simple HTML Browser")
> frm.Show()
> app.MainLoop()
>
> with the following result:
>
> Traceback (most recent call last):
> File "C:\home\python\gui\wxPythonInAction-src\Chapter-16\iehtml.py",
> line 17, in -toplevel-
> frm = MyHtmlFrame(None, "Simple HTML Browser")
> File "C:\home\python\gui\wxPythonInAction-src\Chapter-16\iehtml.py",
> line 11, in __init__
> name='IEHtmlWindow')
> TypeError: __init__() got multiple values for keyword argument 'ID'
>
> Commenting out the ID=-1 argument (don't know why this helps, since it
> looks like -1 is the default)
> I get:
>
> Traceback (most recent call last):
> File "C:\home\python\gui\wxPythonInAction-src\Chapter-16\iehtml.py",
> line 17, in -toplevel-
> frm = MyHtmlFrame(None, "Simple HTML Browser")
> File "C:\home\python\gui\wxPythonInAction-src\Chapter-16\iehtml.py",
> line 11, in __init__
> name='IEHtmlWindow')
> File "C:\Program Files\Python24\lib\site-packages\wx-
> 2.6-msw-unicode\wx\lib\iewin.py", line 117, in __init__
> ID, pos, size, style, name)
> File "C:\Program Files\Python24\lib\site-packages\wx-
> 2.6-msw-unicode\wx\activex.py", line 440, in __init__
> newobj = _activex.new_IEHtmlWindowBase(*args, **kwargs)
> TypeError: argument number 3: a 'number' is expected, 'NoneType(None)' is
> received
>
> The IDLE stack inspector hanges trying to display the iewin.py frame.
>
> Help much appreciated!
>
> Chris
>



--
-Richard Burton
From: Robin Dunn on
Chris Haynes wrote:
> Per section 16.3.4 of the wxPython book, I tried the following
> modification of listing 16.3
>
> import wx
> import wx.lib.iewin
>
> class MyHtmlFrame(wx.Frame):
> def __init__(self, parent, title):
> wx.Frame.__init__(self, parent, -1, title, size=(600,400))
> html = wx.lib.iewin.IEHtmlWindow(self, parent, ID=-1,
> pos=wx.DefaultPosition,
> size=wx.DefaultSize,
> style=0,
> name='IEHtmlWindow')

The problem is that you are passing both self and parent, so the 2nd
parameter (parent) is going into the ID parameter slot, and so is the
ID=-1 keyword arg. What you wanted to do was top pass self as the
parent parameter, like this:

html = wx.lib.iewin.IEHtmlWindow(self, ID=-1,
pos=wx.DefaultPosition,
size=wx.DefaultSize,
style=0,
name='IEHtmlWindow')

And since you are using the defaults for everything you could abbreviate
it like this:

html = wx.lib.iewin.IEHtmlWindow(self)

or if you want to be more explicit about what self is used for:

html = wx.lib.iewin.IEHtmlWindow(parent=self)


--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!


---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org

From: "Chris Haynes" on
Similar result. wx.ID_ANY is -1, and all the named arguments aren't
necessary in this call as they are the defaults.

But on closer inspection it looks like the first argument, self, is in
error, as this is a new construction, not a super call.
So my best current guess is

html = wx.lib.iewin.IEHtmlWindow(parent)

But with that I get

Traceback (most recent call last):
File "C:\home\python\src\iehtml.py", line 18, in -toplevel-
frm = MyHtmlFrame(None, "Simple HTML Browser")
File "C:\home\python\src\iehtml.py", line 7, in __init__
html = wx.lib.iewin.IEHtmlWindow(parent)
File "C:\Program
Files\Python24\lib\site-packages\wx-2.6-msw-unicode\wx\lib\iewin.py", line
117, in __init__
ID, pos, size, style, name)
File "C:\Program
Files\Python24\lib\site-packages\wx-2.6-msw-unicode\wx\activex.py", line
440, in __init__
newobj = _activex.new_IEHtmlWindowBase(*args, **kwargs)
PyAssertionError: C++ assertion "wxAssertFailure" failed in
...\..\src\msw\window.cpp(549): can't create wxWindow without parent
>>>

and my whole screen (above the task bar) goes white! Fortunately alt-tab
still works and when I kill the shell the screen recovers. Very strange. Any
other thoughts?

Best,
Chris

Try the following:

html = wx.lib.iewin.IEHtmlWindow(self, parent, wx.ID_ANY,
pos=wx.DefaultPosition,
size=wx.DefaultSize,
style=0,
name='IEHtmlWindow')

Best Regards,

On 8/22/06, Chris Haynes <chaynes(a)indiana.edu> wrote:
>
> Per section 16.3.4 of the wxPython book, I tried the following
> modification of listing 16.3
>
> import wx
> import wx.lib.iewin
>
> class MyHtmlFrame(wx.Frame):
> def __init__(self, parent, title):
> wx.Frame.__init__(self, parent, -1, title, size=(600,400))
> html = wx.lib.iewin.IEHtmlWindow(self, parent, ID=-1,
> pos=wx.DefaultPosition,
> size=wx.DefaultSize,
> style=0,
> name='IEHtmlWindow')
>
> wx.CallAfter(
> html.LoadString(file('c:/home/201/c/slides.html')))
>
> app = wx.PySimpleApp()
> frm = MyHtmlFrame(None, "Simple HTML Browser")
> frm.Show()
> app.MainLoop()
>
> with the following result:
>
> Traceback (most recent call last):
> File "C:\home\python\gui\wxPythonInAction-src\Chapter-16\iehtml.py",
> line 17, in -toplevel-
> frm = MyHtmlFrame(None, "Simple HTML Browser")
> File "C:\home\python\gui\wxPythonInAction-src\Chapter-16\iehtml.py",
> line 11, in __init__
> name='IEHtmlWindow')
> TypeError: __init__() got multiple values for keyword argument 'ID'


From: Robin Dunn on
Chris Haynes wrote:
> Similar result. wx.ID_ANY is -1, and all the named arguments aren't
> necessary in this call as they are the defaults.
>
> But on closer inspection it looks like the first argument, self, is in
> error, as this is a new construction, not a super call.
>
> So my best current guess is
>
> html = wx.lib.iewin.IEHtmlWindow(parent)


See
http://lists.wxwidgets.org/cgi-bin/ezmlm-cgi?8:msp:93517:fijbnmpjbjeoomhmocik


--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!


---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org