Skip to Main Content
Learning Perl/Tk
book

Learning Perl/Tk

by Nancy Walsh
January 1999
Beginner content levelBeginner
373 pages
9h 43m
English
O'Reilly Media, Inc.
Content preview from Learning Perl/Tk

9.1. Creating a Canvas

I recommend that you always use the Scrolled method to create a canvas unless you know for sure that your canvas is going to be a fixed size that will fit in the window:

$canvas = $mw->Canvas( [ option => values, ... ] )->pack();
# or...
$canvas = $mw->Scrolled('Canvas', [ option => values, ... ])->pack();

The first line creates just a canvas and the second creates a canvas with scrollbars. (See Chapter 6, for more information on what else you can do with the Scrolled method.) To create a canvas widget, use the desired parent widget to invoke the Canvas method and pass any initial options in with their values. The Canvasmethod returns a reference to the newly created canvas widget.

Before we get into the options and methods available with a canvas widget, here are a few miscellaneous things you should know about using a canvas widget.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Perl/Tk

Mastering Perl/Tk

Stephen Lidie, Nancy Walsh

Publisher Resources

ISBN: 1565923146Supplemental ContentCatalog PageErrata