Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have searched the perldocs, and perlmonk archives with no luck.

I would like to know how to disable the minimize, maximize, and close button for a mainwindow in Tk.

my $mw = MainWindow->new; $mw->title("FOO BAR"); $mw->deiconify(); #Doesn't work

Any ideas, or is this even possible?

Replies are listed 'Best First'.
Re: Tk Main window controls
by physi (Friar) on Feb 11, 2003 at 16:39 UTC
    $mw->deiconify();
    will raise your mainwindow, if it's iconified before.
    What you're looking for is maybe this:
    $mw->protocol('WM_DELETE_WINDOW', \&ExitApplication); MainLoop; sub ExitApplication { # do nothing }

    I'm not sure if there are other protocol-types for raise and the stuff in the right top corner ...

    -----------------------------------
    --the good, the bad and the physi--
    -----------------------------------
    
      Works perfect!
      Thanks
Re: Tk Main window controls
by traveler (Parson) on Feb 11, 2003 at 17:09 UTC
    <Disclaimer> I have not tried this in perl and it may depend on your OS. </Disclaimer>

    Any ideas...? These buttons generate events to your top level window. You might try binding those events to nops or dummy functions as physi suggested. Check out tk::bind

    HTH, --traveler