Home > Archive > PerlTk > June 2004 > maximize with command
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
maximize with command
|
|
|
| is there a way to maximize and minimize a window with a command from within
the script?
thx
--
lucas
-------------------------
Perl Coder since 2001
shift || die;
-------------------------
| |
| zentara 2004-06-13, 8:56 am |
| On Sat, 12 Jun 2004 21:57:19 -0400, lucas <aolblowz@yahoo.com> wrote:
>is there a way to maximize and minimize a window with a command from within
>the script?
#!/usr/bin/perl
use warnings;
use Tk;
use strict;
my $main = MainWindow->new(-title => "Resize Test");
$main->geometry("600x400+100+100");
$main->Button(
-text => "Exit Program",
-command => sub { exit }
)->pack();
my $button = $main->Button(
-text => "Go To Fullscreen",
-command => \&resizer,
)->pack();
MainLoop;
sub resizer{
if ( $button->cget(-text) =~ /Fullscreen/ ){
$main->geometry($main->screenwidth . 'x' .
$main->screenheight . '+0+0');
$button->configure(-text=>"Go to Window");
}else{
$main->geometry("600x400+100+100");
$button->configure(-text=>"Go To Fullscreen");
}
}
__END__
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
| |
|
| zentara wrote:
> On Sat, 12 Jun 2004 21:57:19 -0400, lucas <aolblowz@yahoo.com> wrote:
>
> #!/usr/bin/perl
> use warnings;
> use Tk;
> use strict;
>
> my $main = MainWindow->new(-title => "Resize Test");
> $main->geometry("600x400+100+100");
>
> $main->Button(
> -text => "Exit Program",
> -command => sub { exit }
> )->pack();
>
> my $button = $main->Button(
> -text => "Go To Fullscreen",
> -command => \&resizer,
> )->pack();
>
> MainLoop;
>
> sub resizer{
>
> if ( $button->cget(-text) =~ /Fullscreen/ ){
>
> $main->geometry($main->screenwidth . 'x' .
> $main->screenheight . '+0+0');
> $button->configure(-text=>"Go to Window");
> }else{
> $main->geometry("600x400+100+100");
> $button->configure(-text=>"Go To Fullscreen");
>
> }
>
> }
> __END__
>
>
>
Perfect. Thanks,
--
lucas
-------------------------
Perl Coder since 2001
shift || die;
-------------------------
| |
| $_@_.%_ 2004-06-13, 8:57 pm |
|
lucas <aolblowz@yahoo.com> wrote in message-id:
<lZ6dne_UDKB-ClHd4p2dnA@golden.net>
>
>zentara wrote:
>
>
>Perfect. Thanks,
>--
>lucas
>-------------------------
>Perl Coder since 2001
>shift || die;
>-------------------------
Beware - this will break the window manager (normal) maximize/minimize button.
| |
| Slaven Rezic 2004-06-14, 9:06 am |
| $_@_.%_ wrote in message news:<Fo3zc.22792$mz.5515@nwrdny02.gnilink.net>...
> lucas <aolblowz@yahoo.com> wrote in message-id:
> <lZ6dne_UDKB-ClHd4p2dnA@golden.net>
>
> Beware - this will break the window manager (normal) maximize/minimize button.
Also this code won't take the task bars into account. Make a google or
newsgroup search for the Win32Util and KDEUtil modules which provide
solutions to get the available client region.
Regards,
Slaven
|
|
|
|
|