[Tutor] Help me : Why this code is not working??

Asrarahmed Kadri ajkadri at googlemail.com
Fri Oct 13 01:38:42 CEST 2006


I have created two buttons. The code for button2 is not working as I want it
to be. When I click button2, the application should exit, but it isnt.
Can someone fix it??

from Tkinter import *
from tkMessageBox import *

def callback():
    showinfo('message','I am here...')

def QUIT():
    ans = askyesno('Confirm','Do you really want to quit?')
    if ans:
        root.exit
    else:
        showinfo('Selection','You have decided to stay on')

root = Tk()
win = Frame(root)
win.pack()

button1 = Button(win,text='Hello',command=callback)
button1.pack(side=LEFT)

button2 = Button(win,text='Quit',command=QUIT)
button2.pack(side=RIGHT)

root.mainloop()

-- 
To HIM you shall return.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20061013/c1179984/attachment.htm 


More information about the Tutor mailing list