develooper Front page | perl.beginners | Postings from August 2009

Scrolled Frame in Tkx

Ken Slater
August 24, 2009 07:13
Scrolled Frame in Tkx
Message ID:
Hi all,

I posted this a few days ago on but have no responses.
So, I am hoping someone on this list may have some expertise. I will
post any answers on the list (sorry for the cross post).

I'm trying to convert some Perl/Tk code to Perl/Tkx.
One problem I'm having is with scrollbars. I have a scrolled
frame in Tk and am trying to implement that in Tkx.
I saw the example on <> for
"ScrollableFrame and ScrolledWindow" using tcl and have
tried to implement this in Perl/Tkx.

The code is below. It is failing with the message:

Can't call method "pack" without a package or object reference
at line 19.

Line is indicated in the code below.

Evidently, my call to getframe is not returning an object or
reference. When I dump $mwf, I get '.s.s.frame'.

Does anybody have any ideas? I am just a beginner with Tkx and
wasn't sure where to post any questions. Any help is appreciated.

Thanks, Ken

==================  Code  =====================
use strict;
use warnings;
use Tkx;
use Data::Dumper;
Tkx::package_require("BWidget"); # new_ScrolledWindow

my $font = 'Courier 10 normal';

my $mw    = Tkx::widget->new('.');
my $mws   = $mw->new_ScrolledWindow();
my $mwsf  = $mws->new_ScrollableFrame();
my $mwf   = $mwsf->getframe();



for my $idx ( 1 .. 60 )
    $mwf->new_checkbutton(-text     => $idx,
                          -font     => $font,
                         )->g_pack(-side=>'top', -anchor=>'w');


sub printIds
    print "mws:\n";
    print Dumper "$mws";
    print "mwsf:\n";
    print Dumper "$mwsf";
    print "mwf:\n";
    print Dumper "$mwf";
    print "\n";
} Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About