Scale 
Author Message
 Scale

Newbie back again. Thanks for the previous help. I'm having a problem and I'm
not sure if there is a possible solution to it.

I have one integer variable value that will change often. Can I set up a Scale
widget to update it's range of values when the variable changes? In other words
I'd like the highest end of the scale to always be equal to the integer variable
so that the user can scroll it from 0 to the limit to the variable.

Thanks for the help again.
Shain



Sat, 21 Jun 2003 22:40:19 GMT  
 Scale

Quote:
> Newbie back again. Thanks for the previous help. I'm having a problem and I'm
> not sure if there is a possible solution to it.

> I have one integer variable value that will change often. Can I set up a Scale
> widget to update it's range of values when the variable changes? In other words
> I'd like the highest end of the scale to always be equal to the integer variable
> so that the user can scroll it from 0 to the limit to the variable.

Use the configure() method:

        use strict;
        use Tk;
        my $max = 100;
        my $mw = tkinit;
        my $scale = $mw->Scale(-to => $max)->pack;
        $mw->Button(
                -text => 'Increment Scale',
                -command => sub{$scale->configure(-to => $max += 100)},
        )->pack;
        MainLoop;

--
Marc Dashevsky  (remove "_" from address to reply by e-mail)



Sun, 22 Jun 2003 08:46:46 GMT  
 Scale

Thanks! It works perfectly now. I wasn't assigning the Scale widget to a
variable (It wasn't showing in the book that you could do such a thing. PERL:
Little black book.)  So I couldn't figure out how to use the configure method to
it.

Shain

Quote:
>Use the configure() method:

>    use strict;
>    use Tk;
>    my $max = 100;
>    my $mw = tkinit;
>    my $scale = $mw->Scale(-to => $max)->pack;
>    $mw->Button(
>            -text => 'Increment Scale',
>            -command => sub{$scale->configure(-to => $max += 100)},
>    )->pack;
>    MainLoop;

>--
>Marc Dashevsky  (remove "_" from address to reply by e-mail)



Sun, 22 Jun 2003 17:46:06 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Canvas->Scale and Tk::Scale conflict?

2. perl program to create fonts.scale for X11R5 Type1 font renderer

3. looking for guttman scaling algorithm

4. module naming proposal: Number::Scale

5. Scaling a DNA string

6. Tied hash not scaling - advice?

7. Scaling up sample data in an array of hashes

8. Scale/Mode calculator

9. RESG Event: Large Scale Requirements Analysis, 3 November 2000, UMIST

10. Large-scale file reads/writes and efficiency

11. Disabling a Scale widget

12. unknown warning when setting scale length

 

 
Powered by phpBB® Forum Software