in reply to How to catch pushing the window "Exit" button in Perl/Tk?

I'm not sure if this works on Windows, but on Linux, this disables or intercepts the window manager's close button. If you just want to disable the close icon, set the sub to an empty {}.
#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = new MainWindow; $mw->title("Close test"); $mw->geometry("400x250"); #prevents mw from closing $mw->protocol('WM_DELETE_WINDOW' => sub { print "do stuff here before the exit\n"; exit; }); MainLoop;

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku