[newbie] problem trying out simple non object oriented use of Tkinter
Jean Dubois
jeandubois314 at gmail.com
Fri Dec 6 07:24:59 EST 2013
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
More information about the Python-list
mailing list