Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Tk main window protocole maximize

by tybalt89 (Monsignor)
on Apr 24, 2018 at 19:52 UTC ( [id://1213495]=note: print w/replies, xml ) Need Help??


in reply to Tk main window protocole maximize

You can get the new size when it is changed by binding to Configure.

Here's an example that does that:

#!/usr/bin/perl # http://perlmonks.org/?node_id=1213422 use strict; use warnings; use Tk; my $mw = MainWindow->new; my $c = $mw->Canvas( -width => 400, -height => 400, -bg => 'red', -highlightthickness => 0, )->pack; for my $row (0..7) { my $color = $row % 2; for my $col (0..7) { $c->createRectangle($row*50, $col*50, $row*50+50, $col*50+50, -fill => qw( gold2 green)[$color++ % 2], -outline => undef, ); } } $mw->bind('<Configure>' => sub { print "width ", $mw->width, " height ", $mw->height, "\n"; } ); MainLoop;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-04-18 06:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found