property problems
Newt
newt_e at blueyonder.co.uk
Wed Nov 13 18:18:03 EST 2002
Hi,
I've got a problem trying to use a property in a class module. The class module is listed below (it's called globals.py):
class GlobalVars:
def __init__(self):
self.l_stats = []
return
def set_stats(self,val):
self.l_stats = val[:]
return
def get_stats(self):
return self.l_stats
stats = property(get_stats, set_stats)
gv = GlobalVars()
I've got a further module which does the following:
from globals import gv
gv.stats([['Height',self.height],['Build',self.build],['Strength',str]])
However, I get the following error:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python22\lib\lib-tk\Tkinter.py", line 1292, in __call__
return apply(self.func, args)
File "D:\py_stuff\curry.py", line 14, in __call__
return self.fun(*(self.pending + args), **kw)
File "D:\py_stuff\chaz.py", line 223, in shownext
SelectStats(self)
File "D:\py_stuff\stats.py", line 46, in __init__
self.do_widgets()
File "D:\py_stuff\stats.py", line 208, in do_widgets
gv.stats([['Height',self.height],['Build',self.build],['Strength',str]])
TypeError: 'list' object is not callable
Could somebody explain to mw what this means, and how to fix it please!
Thanks,
Newt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20021113/47f37051/attachment.html>
More information about the Python-list
mailing list