Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

    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?

What time is it? It's Camel Time!

In reply to Re: Re: Re: TK Scrollbars not working correctly by hiseldl
in thread TK Scrollbars not working correctly by Popcorn Dave

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (1)
As of 2022-07-06 03:52 GMT
Find Nodes?
    Voting Booth?

    No recent polls found