Hi Jean, On Fri, Dec 06, 2013 at 04:24:59AM -0800, Jean Dubois wrote: > I'm trying out Tkinter with the (non object oriented) code fragment below: > It works partially as I expected, but I thought that pressing "1" would > cause the program to quit, however I get this message: > TypeError: quit() takes no arguments (1 given), I tried changing quit to > quit() > but that makes things even worse. So my question: can anyone here help me > debug this?
I don't know the details of the Tkinter library, but you could find out what quit is being passed by modifying it to take a single parameter and printing it out (or using pdb): def quit(param): print(param) sys.exit() Having taken a quick look at the documentation, it looks like event handlers (like your quit function) are passed the event that triggered them. So you can probably just ignore the parameter: def quit(_): sys.exit() Cheers, Dan -- https://mail.python.org/mailman/listinfo/python-list