[wxPython-users] AttributeError:type object 'Panel' has no attribute 'setSizer'

Rakesh Sinha rakesh.usenet at gmail.com
Sat Feb 23 14:53:27 PST 2008


Changing it to self.SetSizer(grid1)

returns the following error.

AttributeError: 'LoginPanel' object has no attribute 'setSizer'



On Sat, Feb 23, 2008 at 12:29 PM, Ben Kaplan <bskaplan14 at yahoo.com> wrote:
>
> In layoutComponents, the call should be self.SetSizer(grid1), not
> wx.Panel.setSizer(grid1)
> ----- Original Message ----
> From: Rakesh Sinha <rakesh.usenet at gmail.com>
> To: wxPython-users at lists.wxwidgets.org
> Sent: Saturday, February 23, 2008 3:02:24 PM
> Subject: [wxPython-users] AttributeError:type object 'Panel' has no
> attribute 'setSizer'
>
>  Hi All -
>   I am playing around with my first Python code here.
>
> import wx
>
> class LoginPanel(wx.Panel):
>     def __init__(self, parent):
>         wx.Panel.__init__(self, parent, -1)
>         self.layoutComponents()
>
>     def layoutComponents(self):
>         grid1    = wx.GridSizer(1, 1, 5, 50)
>         wx.Panel.setSizer(grid1)
>
>         self.lblUsername = wx.StaticText(self, -1, "Username",
> style=wx.ALIGN_RIGHT)
>          grid1.Add(self.lblUsername)
>
>
> class LoginFrame(wx.Frame):
>
>     def __init__(self, parent, ID, title):
>         wx.Frame.__init__(self, parent, ID, title, wx.DefaultPosition,
> wx.Size(400, 250))
>
>         print 'PI is approximately %5.7f.' % math.pi
>         self.panel = LoginPanel(self)
>
>         self.Center()
>         self.Show()
>
>
>
> When I run the program - I am getting the error -
>   "AttributeError: type object 'Panel' has no attribute 'setSizer'"
>
> I am seeing the API - it does seem to have a setSizer in wx.Window from
> which wx.Panel inherits.
> Is there anything that I am missing here.
>
>
>
>
>
>
>  ________________________________
> Never miss a thing. Make Yahoo your homepage.




More information about the wxpython-users mailing list