Want a Scale's size to match size of Entry it is controlling



I've got an Entry widget controlled by a Scale widget, with the scale
below the entry and both in a Frame. I'd like the horizontal size of
the scale to be constrained by the horizontal size of the entry but
can't seem to make it happen without hardcoding the -length value for
the scale, which I'd rather not have to do. See code below.

I figure there should be some combination of pack options that can do
what I want, but can't figure it out.

Any help please? Thanks in advance!

John
----
#!/bin/perl -w

use Tk;

my $mw = MainWindow->new;

my $custmbfr = $mw->Frame(
-relief => 'ridge',
-borderwidth => 2,
) -> pack( -side => 'left' );
my $custmbvalue = 120000;
my $custmb = $custmbfr->Entry(
-textvariable => \$custmbvalue,
-width => 8,
-justify => 'right',
-relief => 'ridge',
-borderwidth => 2,
) -> pack( -side => 'top' );
my $custmbscale = $custmbfr->Scale(
-from => '10000',
-to => '600000',
-resolution => '1000',
-variable => \$custmbvalue,
-orient => 'horizontal',
-showvalue => 0,
# -length => 75, # uncomment to get effect I want
-sliderlength => 8,
-width => 12,
-borderwidth => 0,
) -> pack( -side => 'top' );

$mw->MainLoop;
.



Relevant Pages