[EMAIL PROTECTED] wrote: > Scott David Daniels wrote: >> Gabriel Genellina wrote: >> >... So `callback` should return a function, like this: >> > >> > def callback(text): >> > def handler(event): >> > print text >> > >> >> Even better than that: >> def callback(text): >> def handler(event): >> print text >> return handler >> >> Otherwise callback returns the spectacularly un-useful value None.
> C:\dex_tracker\csdlist.py bay-at-night.csd > Traceback (most recent call last): > File "C:\dex_tracker\csdlist.py", line 58, in > root.mainloop() > File "C:\Python25\lib\lib-tk\Tkinter.py", line 1023, in mainloop > self.tk.mainloop(n) > File "../../..\Pmw\Pmw_1_2\lib\PmwBase.py", line 1751, in __call__ > File "../../..\Pmw\Pmw_1_2\lib\PmwBase.py", line 1777, in _reporterror > TypeError: unsupported operand type(s) for +: 'type' and 'str' > Script terminated. > > It doesn't like the return handler part of it. Probably because a Tkinter.Button command callback doesn't accept any arguments. Try def callback(text): def handler(): print text return handler Note that 'make_callback' would be a better name than 'callback' because the function 'callback' actually creates the callback (called 'handler'). Peter -- http://mail.python.org/mailman/listinfo/python-list