----- Original Message -----
> 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?
> 
> #!/usr/bin/env python
> import Tkinter as tk
> def quit():
>     sys.exit()
> root = tk.Tk()
> label = tk.Label(root, text="Hello, world")
> label.pack()
> label.bind("<1>", quit)
> root.mainloop()
> 
> p.s. I like the code not object orientated
> --
> https://mail.python.org/mailman/listinfo/python-list
> 

the engine is probably passing an argument to your quit callback method.

try  

def quit(param):
  sys.exit(str(param))

You probably don't even care about the parameter:

def quit(param):
  sys.exit()

JM


-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be 
privileged. If you are not the intended recipient, please notify the sender 
immediately and do not disclose the contents to any other person, use it for 
any purpose, or store or copy the information in any medium. Thank you.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to