> > Hi, > > When I have a tk window open and I close it with the close (X) button up in > the corner (Windows 98), Tk.mainloop returns and the program continues > execution. (Of course, there usually is no more program, but never mind > that for the moment.) However, if I click a button with command {proc > exit}, the whole ruby program stops right there... do not pass GO, etc. You "exit" Ruby! What do you expect? > Does anyone know why this is? Can I close my tk window and have Tk.mainloop > return to the rest of the program nicely without clicking the "X" button? > What happens when I click the "X" button? root = TkRoot.new() button = TkButton.new(root) button.command { root.destroy() } when you click "X", the window is destroyed in the same way. When you destroy the root window, Tk stops after producing a series of events that you can catch: root.bind("Destroy") { |event| p event if event.widget == root # You also get this event for # the destruction of all widgets within the window :) } +--- Kero ------------------------------ kero / chello.nl ---+ | Don't split your mentality without thinking twice | | Proud like a God -- Guano Apes | +--- M38c ------- http://members.chello.nl/~k.vangelder ---+