Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Remove the Maximise and minimize button in TK

by gopalr (Priest)
on Jan 20, 2005 at 04:43 UTC ( [id://423597]=perlquestion: print w/replies, xml ) Need Help??

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

Hi Monks

I am new to perl tk.

Pls tell me how to remove the maximise and minimize button in the MainWindow>

Also, I want to disable the resizing of MainWindow

thanx

Considered by spurperl - is this really a front-page question ??
Unconsidered by castaway - Keep/Edit/Delete: 8/11/0 - Yes, it is.

Replies are listed 'Best First'.
Re: Remove the Maximise and minimize button in TK
by sasikumar (Monk) on Jan 20, 2005 at 05:52 UTC
    Hi

    Use this code to prevent resizing
    my($top) = MainWindow->new(); $top->title("Example"); $top->resizable(0,0);


    Thanks
    SasiKumar
Re: Remove the Maximise and minimize button in TK
by zentara (Archbishop) on Jan 20, 2005 at 12:03 UTC
    Also check out
    $mw->overrideredirect(1); # set the override-redirect flag # removes all window manager controls $mw->packPropagate(0); # prevent the window being resized

    I'm not really a human, but I play one on earth. flash japh
Re: Remove the Maximise and minimize button in TK
by jonadab (Parson) on Jan 20, 2005 at 11:44 UTC
    In the general case, an application does not have the ability to do these things, because these things are controlled by the window manager. It may be possible in certain cases, i.e., with window managers that provide a mechanism for it, but if so it wouldn't be the least bit portable: as soon as somebody runs the app under a different window manager, it won't work. Probably the most common way to accomplish these things is to eschew the standard window widget altogether and draw your own shape; media players such as yamp and xmms tend to do this. However, this too is somewhat unportable, and I don't think Tk provides the ability to do it. (Tk is, after all, a widget set, and applications that do this don't use a standard widget set; they have to draw just about everything themselves, I think; at least, that's the approach most of them seem to take.) And like I said, it's unportable; xmms had to have a new frontend created to run under Ion. (Fortunately, xmms has the functional backend cleanly separated from the graphical frontend so that this was easy to do; it also has a frontend for Emacs and a text-based one for consoles and terminals.)
Re: Remove the Maximise and minimize button in TK
by merlyn (Sage) on Jan 20, 2005 at 07:21 UTC
    I want to disable the resizing of MainWindow
    That's really really user hostile. You should create a layout that adapts to the size of the window.

    Please explain why you think you know more than your users about how much screen estate they want to give to your top-level.

    -- Randal L. Schwartz, Perl hacker
    Be sure to read my standard disclaimer if this is a reply.

Re: Remove the Maximise and minimize button in TK
by Courage (Parson) on Jan 20, 2005 at 21:22 UTC
    if you're in Windows you may want toolbox attribute. Look:
    use Tk; $mw=tkinit; $tl=$mw->Toplevel; print hex($tl->id); $tl->Button(-text=>'Ok')->pack; #$tl->attributes(-toolwindow=>1); $mw->after(1000,sub {$tl->attributes(-toolwindow=>1)}); MainLoop;

    Best regards,
    Courage, the Cowardly Dog

Re: Remove the Maximise and minimize button in TK
by Anonymous Monk on Jan 21, 2005 at 20:13 UTC
    If you have not already found it I suggest that you get a copy of Mastering Perl/Tk by Lidie and Walsh (O'Reilly).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://423597]
Approved by holli
Front-paged by Courage
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2024-03-19 03:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found