Bug in wx.lib.iewin?

I came across what may be a bug in the iewin module. If I try to
specify the widget's size or position, it errors out.

self.htmlctrl = iewin.IEHtmlWindow(self.panel, size=(600,600), pos =
(300, 20))

Traceback (most recent call last):
  File "D:\starting point\browser.py", line 332, in ?
    frm = MainWindow()
  File "D:\starting point\browser.py", line 171, in __init__
    self.htmlctrl = iewin.IEHtmlWindow(self.panel, size=(600,600), pos
= (300, 20))
  File "C:\Python24\Lib\site-packages\wx-2.8-msw-unicode\wx\lib
\iewin.py", line 57, in __init__
    id, pos, size, style, name)
  File "C:\Python24\lib\site-packages\wx-2.8-msw-unicode\wx\lib
\activex.py", line 83, in __init__
    x = pos.x
AttributeError: 'tuple' object has no attribute 'x'

The error is in the activex.py file, and is fixed as follows:

# changed these lines:
x = pos.x
y = pos.y

# to this:
x = pos[0]
y = pos[1]

# and change these:
w = size.width
h = size.height

# to this:
w = size[0]
h = size[1]

The reason the bug doesn't show in the WXPython demos is that the demo
uses sizers to set the size and position, instead of specifying.

Its entirely possible I'm doing something stupid, and I should also
say I'm using Python 2.4, but I thought I'd mention it in case anyone
else is having the problem.

I could be mistaken as well, but that looks like a bug to me too.

- Mike

···

On Jul 21, 1:54 am, wrybread <wrybr...@gmail.com> wrote:

I came across what may be a bug in the iewin module. If I try to
specify the widget's size or position, it errors out.

self.htmlctrl = iewin.IEHtmlWindow(self.panel, size=(600,600), pos =
(300, 20))

Traceback (most recent call last):
File "D:\starting point\browser.py", line 332, in ?
frm = MainWindow()
File "D:\starting point\browser.py", line 171, in __init__
self.htmlctrl = iewin.IEHtmlWindow(self.panel, size=(600,600), pos
= (300, 20))
File "C:\Python24\Lib\site-packages\wx-2.8-msw-unicode\wx\lib
\iewin.py", line 57, in __init__
id, pos, size, style, name)
File "C:\Python24\lib\site-packages\wx-2.8-msw-unicode\wx\lib
\activex.py", line 83, in __init__
x = pos.x
AttributeError: 'tuple' object has no attribute 'x'

The error is in the activex.py file, and is fixed as follows:

# changed these lines:
x = pos.x
y = pos.y

# to this:
x = pos[0]
y = pos[1]

# and change these:
w = size.width
h = size.height

# to this:
w = size[0]
h = size[1]

The reason the bug doesn't show in the WXPython demos is that the demo
uses sizers to set the size and position, instead of specifying.

Its entirely possible I'm doing something stupid, and I should also
say I'm using Python 2.4, but I thought I'd mention it in case anyone
else is having the problem.

wrybread wrote:

I came across what may be a bug in the iewin module. If I try to
specify the widget's size or position, it errors out.

self.htmlctrl = iewin.IEHtmlWindow(self.panel, size=(600,600), pos =
(300, 20))

Traceback (most recent call last):
  File "D:\starting point\browser.py", line 332, in ?
    frm = MainWindow()
  File "D:\starting point\browser.py", line 171, in __init__
    self.htmlctrl = iewin.IEHtmlWindow(self.panel, size=(600,600), pos
= (300, 20))
  File "C:\Python24\Lib\site-packages\wx-2.8-msw-unicode\wx\lib
\iewin.py", line 57, in __init__
    id, pos, size, style, name)
  File "C:\Python24\lib\site-packages\wx-2.8-msw-unicode\wx\lib
\activex.py", line 83, in __init__
    x = pos.x
AttributeError: 'tuple' object has no attribute 'x'

Thanks for reporting this.

The reason the bug doesn't show in the WXPython demos is that the demo
uses sizers to set the size and position, instead of specifying.

You can also workaround it by passing a wx.Point and wx.Size instead of tuples.

···

--
Robin Dunn
Software Craftsman