I am developing a Perl Tk app and have created a nice background image that I want to display throughout for each screen. So I decided to use a Canvas widget to draw the background image then everything else on top of it. Well it looks great but even though I used Scrolled("Canvas") The window does not scroll when I reduce the resolution from 1280x800 to 1024x768 to 800x600.

I could create a background image for each size and check the screen size before I load the main screen and render the canvas according to the resolution. But i'm sure there is a better way to just make this Canvas scroll.

I've tried to use Scrolled, Pane, even attach scrollbars -- Nothing is scrolling this background image. Any suggestions, advice or the solution :-) would be appreciated.

use Tk; my $mw = MainWindow->new; my $mycanvas = $mw->Scrolled("Canvas",-width=>800, -height=>600, -scro +llbars=>'se'); my $headerpicpath = $Bin."logo.gif"; my $pic = $mw->Photo(-file=>$headerpicpath); $mycanvas->createImage(425,400,-image=>$pic);

In reply to Perl/Tk Scroll by mikasue

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.