"TypeError: wx.Window, wx.Sizer, wx.Size, or (w, h) expected for item"

ixarka at gmail.com ixarka at gmail.com
Mon Jan 14 18:25:04 PST 2008


A quick followup:

I just confirmed that this only happens when I build with gcc/g++ 4.1.1.  If
I build with 3.4.6, then that sample code runs fine.  I'm doing these builds
on a 64-bit system.


On 1/14/08, ixarka at gmail.com <ixarka at gmail.com> wrote:
>
> Hello,
>
> I just built the latest release version of wxPython from source and I keep
> getting this error when I try to run some code that worked before.  When I
> try to run the following sample code:
>
> import wx
>
> class MyFrame (wx.Frame):
>    def __init__(self, parent, ID , title):
>        wx.Frame .__init__(self, parent, ID, title, size=3D(300 , 250))
>
>        panel1 =3D wx.Panel(self, -1, style=3Dwx.SUNKEN_BORDER )
>        panel2 =3D wx.Panel (self,-1, style=3D wx.SUNKEN_BORDER)
>
>        panel1 .SetBackgroundColour("BLUE")
>        panel2 .SetBackgroundColour("RED")
>
>        box =3D wx.BoxSizer(wx .VERTICAL)
>        box.Add( panel1, 2, wx.EXPAND )
>        box.Add(panel2, 1, wx.EXPAND)
>
>        self.SetAutoLayout(True)
>        self.SetSizer(box)
>        self.Layout()
>
>
> app =3D wx.PySimpleApp( )
> frame =3D MyFrame(None, -1, "Sizer Test")
> frame.Show()
> app. MainLoop()
>
> I get this error:
>
> Traceback (most recent call last):
>   File "/tmp/ixarka/test2.py", line 24, in <module>
>     frame =3D MyFrame(None, -1, "Sizer Test")
>   File "/tmp/ixarka/test2.py", line 15, in __init__
>     box.Add(panel1, 2, wx.EXPAND)
>   File "/home/ixarka/lib/python2.5/site-packages/wx-2.8-gtk2-ansi/wx/_cor=
e.py",
> line 12475, in Add
>     return _core_.Sizer_Add(*args, **kwargs)
> TypeError: wx.Window , wx.Sizer, wx.Size, or (w,h) expected for item
>
>
>
> If I try to run a simpler wx example (without sizers), like this:
>
> import wx
> app =3D wx.PySimpleApp()
> frame =3D wx.Frame(None, - 1, "Just one child", size=3D( 250,150))
> button =3D wx.Button(frame, - 1, "This is resized")
> frame. Show()
> app.MainLoop( )
>
>
> Everything works fine.  Any idea what could be going on?
>
> Thanks.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200801=
14/bf09a2a5/attachment.htm


More information about the wxpython-users mailing list