http://www.perlmonks.org?node_id=193792

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

I want my Tk application to be maximized.
(That is not screensize resized, i found that already)

Has anyone succeeded on this ?

Originally posted as a Categorized Question.

  • Comment on How can i maximize a Tk application on win32 ?

Replies are listed 'Best First'.
Re: How can i maximize a Tk application on win32 ?
by kschwab (Vicar) on Aug 31, 2002 at 13:41 UTC
    You are probably looking for Tk::Wm, which came with Tk. See: the docs.

    In particular, have a look at the geometry and maxsize methods. You may also end up needing the iconify method.

    Originally posted as a Categorized Answer.

Re: How can I maximize a Tk application? (Win32)
by eserte (Deacon) on Mar 26, 2004 at 09:24 UTC

    Win32::API's ShowWindow provides access to the Win32 native API function which does this.

    I might suggest the Win32Util module; it has a maximize function which conveniently tries to maximize in one of two ways: using ShowWindow if Win32::API is installed, or, as a fallback, resizing the window to the screen size.

Re: How can i maximize a Tk application on win32 ?
by schweini (Friar) on Oct 14, 2002 at 00:43 UTC
    it's not really maximized, but kinda does the trick for me:
    (my $xres, my $yres) = $mainwin->maxsize; $mainwin->geometry("=".$xres."x".$yres);

    Originally posted as a Categorized Answer.

Re: How can i maximize a Tk application on win32 ?
by Mr. Muskrat (Canon) on Oct 14, 2002 at 15:02 UTC

    I don't remember where I found this snippet but here goes:

    $mw->geometry($mw->screenwidth . "x" . $mw->screenheight . "+0+0");

    Originally posted as a Categorized Answer.

Re: How can I maximize a Tk application? (Win32)
by kelan (Deacon) on Aug 30, 2002 at 13:09 UTC

    I don't think it's possible through Tk. Being maximized or not isn't a property of the application, it's a property of the window, and windows are "owned" by the GUI (Windows), not by the application (Tk).

    I think you'd have to find some way to send a maximization request to the GUI so that it will maximize the window for you. Something somewhere in the Win32 modules might have something you could use.

    Update: My intuition was right, but eserte provided the concrete answer.

Re: How can i maximize a Tk application on win32 ?
by Anonymous Monk on Mar 03, 2004 at 22:01 UTC
    I have found a bizarre way of getting around... here it goes, instead of writing :: $mw->geometry($mw->screenwidth . "x" . $mw->screenheight . "+0+0");

    go for ::

    $mw->geometry($mw->screenwidth . "x" . $mw->screenheight . "-0-0");


    Originally posted as a Categorized Answer.