Hi,
Hi,
In this small code, I'd like to obtain the values of x and y. I know that
without the funcion 'wx.Panel', it works, but with it, it doesn't. Do you
know how I could do it?class values(wx.Panel):
x = 1
def data(self):
y = 5
return(y)print values().x
print values().data()
Your 'value' class is a sublcass of wx.Panel. Its constructor requires
some arguements. You can't just create it like values(), a panel
requires a parent window as the first arg.
i.e)
frame = wx.Frame(None)
panel = values(frame)
Also
You have defined 'x' as a class variable so you don't have to have
instance of the class object to access it.
i.e)
values.x
data() is a function that requires an instance of the class to be run so
print values(frame).data()
May be helpful: The Python Tutorial — Python 3.13.0 documentation
Cody
···
On Thu, Jan 21, 2010 at 12:31 PM, Ignacio <ignacio.puyol@gmail.com> wrote: