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

Ben Kaplan bskaplan14 at yahoo.com
Sat Feb 23 12:29:34 PST 2008


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. 











      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/20080223/ddcba120/attachment.htm


More information about the wxpython-users mailing list