Profile

unixronin: Galen the technomage, from Babylon 5: Crusade (Default)
Unixronin

December 2012

S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829
3031     

Most Popular Tags

Expand Cut Tags

No cut tags
Monday, February 27th, 2006 05:09 pm

Suppose you're writing an applet using PerlTk, and you want to specify the initial size of your window (not, really, an unreasonable request).  You hunt through the PerlTk documentation and the O'Reilly Tk book, and you eventually find out that according to these resources, the correct way to do this is as follows (non-essential code snipped for brevity):

#!/usr/bin/perl
use strict;
use Tk;
...
main();
...
MainLoop();
quit();

sub main
{
    $app = MainWindow->new(-height => 600,
                                               -width   => 800);
    $app -> formGrid(40,30);

There's just one problem with this:  It turns out not to work.  I've dug into the issue several times since writing this code, and never found a reason why it didn't work, when according to all the documentation it should have been working.

Today, it occurred to me to ask my fellow Perl monks and see whether one of them knew the answer to this conundrum.  It turned out someone did, and in fact, commented:

"Oh, that doesn't work.  It's never worked."

It turns out that what you actually have to do is this:

sub main
{
    $app = MainWindow->new();
    $app->geometry("800x600");
    $app -> formGrid(40,30);

And then it'll work.

So now you know.  The moral of the story?  Know when to Ignore, rather than Read, the ... uh ... Fine Manual.

Tags: