in reply to How to adjust -tk program to the width of the screen?
#!/usr/bin/perl use warnings; use strict; use Tk; 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"); } }
|
|---|