Message12523
This can lead to a lot of confusion.
If I do `"spam" in widget', I get a TypeError.
Case in point: (the code in question is probably
incorrect, so I am not including it)
/usr/tmp/python-14024DA
45 self.pack()
46
47 if __name__ == '__main__':
48 widget = TkLife(None, height=20, width=20)
49 widget.loop()
widget undefined
TkLife = <class __main__.TkLife>
None undefined
height undefined
width undefined
/usr/tmp/python-14024DA in
__init__(self=<__main__.TkLife instance>, master=None,
**kw={'height': 20, 'width': 20})
27 self['state'] = Tkinter.DISABLED
28
29 if 'cells' not in self:
30 assert 'width' in self and 'height'
in self
31 self['cells'] =
randomcells(self['width'], self['height'])
self = <__main__.TkLife instance>
/usr/local/lib/python2.2/lib-tk/Tkinter.py in
cget(self=<__main__.TkLife instance>, key=0)
1088 def cget(self, key):
1089 """Return the resource value for a KEY
given as string."""
1090 return self.tk.call(self._w, 'cget', '-'
+ key)
1091 __getitem__ = cget
1092 def __setitem__(self, key, value):
self = <__main__.TkLife instance>
self.tk = <tkapp object>
self.tk.call = <built-in method call of tkapp object>
self._w = '.135644212'
key = 0
TypeError: cannot concatenate 'str' and 'int' objects
__doc__ =
'Inappropriate argument type.'
__getitem__ =
<bound method TypeError.__getitem__ of
<exceptions.TypeError instance at 0x83202cc>>
__init__ =
<bound method TypeError.__init__ of
<exceptions.TypeError instance at 0x83202cc>>
__module__ =
'exceptions'
__str__ =
<bound method TypeError.__str__ of
<exceptions.TypeError instance at 0x83202cc>>
args =
("cannot concatenate 'str' and 'int' objects",)
The above is a description of an error in a Python
program. Here is
the original traceback:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/tmp/python-14024DA", line 48, in ?
widget = TkLife(None, height=20, width=20)
File "/usr/tmp/python-14024DA", line 29, in __init__
if 'cells' not in self:
File "/usr/local/lib/python2.2/lib-tk/Tkinter.py",
line 1090, in cget
return self.tk.call(self._w, 'cget', '-' + key)
TypeError: cannot concatenate 'str' and 'int' objects
|
|
Date |
User |
Action |
Args |
2007-08-23 14:06:00 | admin | link | issue615772 messages |
2007-08-23 14:06:00 | admin | create | |
|