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

I've written a small TK based script, and I wish to reduce the risk of the end user closing down (or minimizing) the main window. Is there any way that I can remove the minimize, restore and close buttons from the top right of the window???
Merry Christmas!

Replies are listed 'Best First'.
Re: TK Mainwindow buttons
by Vavoom (Scribe) on Dec 24, 2001 at 21:30 UTC
    You almost certainly can, but it is a function of the window manager you are using, rather than a Tk built-in.

    Vavoom
(bbfu) (workaround) Re: TK Mainwindow buttons
by bbfu (Curate) on Dec 24, 2001 at 23:30 UTC

    As Vavoom said, those buttons are a function of the WM. You might check out Tk::WM, specifically, the $toplevel->frame() function.

    Also, as a hack to work around it (if you can't be sure which WM it will be), you could try setting a handler for the WM_RESIZE or WM_MINIMIZE/WM_MAXIMIZE (and no, I'm not sure that those are actual messages ;-) using $toplevel->protocol(?name?,?callback?), or even just try disallowing resize completely with $toplevel->resizable(0,0).

    Just some suggestions to try. I don't know if any will work. Hope it helps, though.

    bbfu
    Seasons don't fear The Reaper.
    Nor do the wind, the sun, and the rain.
    We can be like they are.

Re: TK Mainwindow buttons
by Jouke (Curate) on Dec 25, 2001 at 15:39 UTC
    The problem with this is that it depends on the windowmanager if it obeys the mentioned Tk::WM functions. The Windowmanager can do what it wants with it.

    For example: those functions won't work on Win32 and I believe that Enlightenment also ignores those settings.

    I think what you would want is to run in Fullscreen mode. This is (as far as I know) not supported by any Tk function, but wxPerl supports this for Win32 platforms. Again, the function will be ignored on Un*x flavours.

    Jouke Visser, Perl 'Adept'
    Using Perl to help the disabled: pVoice and pStory