AttributeError:type object 'Panel' has no attribute 'setSizer'

Because it doesn’t have an attribute ‘setSizer’. It has an attribute ‘SetSizer’. All methods in wx are capitalized.

···

----- Original Message ----
From: Rakesh Sinha rakesh.usenet@gmail.com
To: wxPython-users@lists.wxwidgets.org
Sent: Saturday, February 23, 2008 5:53:27 PM
Subject: Re: [wxPython-users] AttributeError:type object ‘Panel’ has no attribute ‘setSizer’

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@yahoo.com wrote:

In layoutComponents, the call should be self.SetSizer(grid1), not
wx.Panel.setSizer(grid1)
----- Original Message ----
From: Rakesh Sinha rakesh.usenet@gmail.com
To: wxPython-users@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.


To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org


Never miss a thing. Make Yahoo your homepage.