Front page | perl.beginners |
Postings from August 2009
Scrolled Frame in Tkx
From:
Ken Slater
Date:
August 24, 2009 07:13
Subject:
Scrolled Frame in Tkx
Message ID:
01NCWAZ0YKEM9EP9OJ@ponyexpress.arl.psu.edu
Hi all,
I posted this a few days ago on comp.lang.perl.tk but have no responses.
So, I am hoping someone on this list may have some expertise. I will
post any answers on the comp.lang.perl.tk 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 <http://wiki.tcl.tk/1091>http://wiki.tcl.tk/1091 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();
printIds();
$mws->setwidget($mwsf);
$mws->g_pack();
$mwf->pack();
for my $idx ( 1 .. 60 )
{
$mwf->new_checkbutton(-text => $idx,
-font => $font,
)->g_pack(-side=>'top', -anchor=>'w');
}
Tkx::MainLoop();
sub printIds
{
print "mws:\n";
print Dumper "$mws";
print "mwsf:\n";
print Dumper "$mwsf";
print "mwf:\n";
print Dumper "$mwf";
print "\n";
}
-
Scrolled Frame in Tkx
by Ken Slater