Tkinter programming problem
Eric Brunel
eric.brunel at pragmadev.com
Thu Aug 7 05:15:37 EDT 2003
furliz wrote:
>> I did try self.frame.destroy as the function self.frame.destroy(),
>> but the Quit button still didn't work. The
>> application can be closed via the window corner X, but I'm still
>> puzzled as to why it does not respond to Quit.
>>
>> Any more suggestions?
>
>
> why don't use 'sys.exit(0)' as command?
> Ex:
> quitButton = Button(root,text="Quit",command=sys.exit(0))
Don't do that!! Written like above, sys.exit(0) will be called when the button
is *created*, not when it is pressed! If you want to do that, write:
quitButton = Button(root, text='Quit', command=lambda: sys.exit(0))
--
- Eric Brunel <eric.brunel at pragmadev.com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com
More information about the Python-list
mailing list