Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Perl/TK: How to set the width and height of the main window?

by MyFSL (Initiate)
on Jul 05, 2007 at 05:47 UTC ( [id://624997]=perlquestion: print w/replies, xml ) Need Help??

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

In Perl/TK

$MW = MainWindow->new(-width=>'600',-height=>'600');

Why doesn't this set the width and height on the Main Window?
How do I set the width and height of the main window?
This is driving me nuts!!!!

perl, v5.8.8 built for i486-linux
HELP!
  • Comment on Perl/TK: How to set the width and height of the main window?

Replies are listed 'Best First'.
Re: Perl/TK: How to set the width and height of the main window?
by Khen1950fx (Canon) on Jul 05, 2007 at 07:13 UTC
    #!/usr/bin/perl use strict; use warnings; use Tk; my $mw = MainWindow->new(); my $c = $mw->Canvas(-width => 600, -height => 600); $c->pack; MainLoop;

    I hope this helps.

Re: Perl/TK: How to set the width and height of the main window?
by strat (Canon) on Jul 05, 2007 at 09:33 UTC

    Well, you can set it that way:

    my $MW = MainWindow->new( -height => 600, -width => 600 );

    or

    my $MW = MainWindow->new; $MW->geometry( "600x600" );

    but if you arrange items that don't fit into that size, your window will enlarge

    in perldoc Tk::Wm the methods ->maxsize and ->minsize could be interesting for you

    Best regards,
    perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"

Re: Perl/TK: How to set the width and height of the main window?
by Akoya (Scribe) on Jul 05, 2007 at 18:10 UTC
    I believe the problem with your code lies in the quotes around the numeric values.
    Try:
    my $MW = MainWindows->new(-width=>600, -height=>600);
    Cheers, Akoya

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-18 23:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found