Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Re: Re: TK Scrollbars not working correctly

by hiseldl (Priest)
on Jan 24, 2003 at 06:33 UTC ( [id://229550]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: TK Scrollbars not working correctly
in thread TK Scrollbars not working correctly

    the only time I want to see the scrollbars is when the image is larger than 300 x 300

Aha! I think you want to set the -scrollregion. Set the -scrollregion after you have populated the canvas so that the scrollbars can reset to where they need to be. I loaded a 300x300 image and the scrollbars were not there, then I loaded a 400x400 image and the scrollbars both appeared.

use Tk 800.000; use Tk::Canvas; use strict; my $main = Tk::MainWindow->new(); my $canvas=$main->Scrolled('Canvas', -scrollbars => 'osoe', -bg=>'white', -width=>300, -height=>300, )->pack(); my $image300x300 = $canvas->Photo(-file=>'300x300.gif'); my $image400x400 = $canvas->Photo(-file=>'400x400.gif'); my $id = $canvas->createImage(200,200,-image => $image400x400); # configure the scrollregion AFTER you populate the # canvas widget to reset the scrollbars $canvas->configure( -scrollregion => [ $canvas->bbox("all") ]); MainLoop;

Is this what you're looking for?

--
hiseldl
What time is it? It's Camel Time!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://229550]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-04-23 15:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found