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

I have a working menubar configured via the "slick, new-fashioned way" from the book Mastering Perl/Tk.

It works, but I need to know that menubar's height. And I can't seem to figure what it is that I call...

?->reqheight

...on? Or how else do I do it?

I've been trough the book and nothing stands out. How might I determine the height if my menubar, please? Don't need the height of any cascaded items, just the always-visilbe bar itself.

Replies are listed 'Best First'.
Re: Finding the height of a menubar
by zentara (Cardinal) on Nov 12, 2007 at 20:49 UTC
    #!/usr/bin/perl use warnings; use strict; use Tk; my $mw = tkinit; my $menubar = $mw->Menu(-type => 'menubar'); $mw->configure(-menu => $menubar); my $menu = $menubar->cascade(-label => '~File'); $menu->command(-label => '~New'); $menu->command(-label => '~Open'); $mw->Button(-text => 'Push me', -command => sub{ print "Reqheight:", $menubar->reqheight, " Reqwidth:", $menubar->reqw +idth, "\n"; } )->pack; MainLoop;

    I'm not really a human, but I play one on earth. Cogito ergo sum a bum