Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Tk MainWindow

by converter (Priest)
on Aug 19, 2003 at 09:33 UTC ( #284831=note: print w/ replies, xml ) Need Help??


in reply to Tk MainWindow

Set the override-redirect flag for the window with the overrideredirect method before mapping it (this is documented in the Tk::Wm man page). Example:

#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = tkinit; $mw->overrideredirect(1); # set the override-redirect flag $mw->packPropagate(0); # prevent the window being resized # for this demo $mw->Button( -text => 'Quit', -command => sub { Tk::exit(0) }, )->pack( -side => 'bottom', ); # after a delay: # withdraw # clear the override-redirect flag # re-map the window $mw->after( 4000, sub { $mw->withdraw; $mw->overrideredirect(0); $mw->deiconify; $mw->raise; } ); # NB: # "Mastering Perl/Tk" mentions that clearing # the override-redirect flag will not cause # the window manager to supply decorations. # This is true, but at least on KDE, clearing # the flag, then unmapping and mapping the # window puts decorations in place. # # Your mileage may vary. MainLoop;

converter


Comment on Re: Tk MainWindow
Select or Download Code
Re: Re: Tk MainWindow
by inelukii (Sexton) on Aug 19, 2003 at 12:55 UTC
    True, overrideredirect will remove the decorations; however, you lose functionality also.

    From Wm.pod

    Setting the override-redirect flag for a window causes it to be ignored by the window manager; among other things, this means that the window will not be reparented from the root window into a decorative frame and the user will not be able to manipulate the window using the normal window manager mechanisms.

    One main limitation I have experienced with this is the inability to bind actions. As converter said, your mileage may vary but I don't think overrideredirect is the solution. I have mainly limited my use of the override-redirect to creating splash screens. If someone knows of a way to remove the decorations but still retain full Tk functionality, I would love to hear it.

    Inelukii
      As with both other respondents I have also tried the override redirect method and the functionality problems aside it is a viable way of achieving what you want. It depends purely what level of GUI functionality you need. It is worth a try.

      jdtoronto

      I think this is more of a window manager issue than a Tk issue. From what I understand, overrideredirect simply tells the window manager not to bother with the window. Since the window manager is what's decorating the window in the first place, this accomplishes your goal. However, the window manager is then unable to do other things with the window.
      milkbone - perl/tk instant messaging - it's the only way to fly

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://284831]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2014-12-20 03:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (95 votes), past polls