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

Ben Kaplan bskaplan14 at yahoo.com
Sun Feb 24 04:59:23 PST 2008


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 at gmail.com>
To: wxPython-users at 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 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.

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







      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/20080224/9c49e879/attachment.htm


More information about the wxpython-users mailing list