From: Mer Gilmartin <merrua / yahoo.co.uk>
Subject: Newbie question Canvas or frame
Date: Tue, 10 Oct 2006 19:19:28 +0900
Message-ID: <183e167ef809521c53ea5d9bded5682e / ruby-forum.com>
> In ruby-tk
> Do you need a canvas to show a picture or is it ok to
> show a picture on a frame?

If you want to show a picture only, you don't need a canvas widget.
Please create a TkPhotoImage object and assign it to `image' option 
of a TkLabel object (or a widget which has `image' option).

Current standard Tcl/Tk suuports only GIF and PPM/PGM formats. 
If you want to treat other formats (JPEG, BMP, and so on), you need 
to use `TkImg' extension (ActiveTcl package already includes it).
Current Ruby/Tk supports TkImg extension.

> When should you use a canvas?

There are many cases.

* When needs a drawing field (and save it by Postscrpt format).

* When want to handle widgets or canvas items (Line, Oval, and so on) 
  by coordinates.
  Please see the example "Ruby/Tk widget demo" which is included in 
  Ruby source archive.

* When want to assign bindings to some parts of a picture
  (e.g. a tree picture which has clickable branches).

* When want to create a scrollable frame. 
  Please see the example "ext/tk/sample/scrollframe.rb" on Ruby 
  source tree.

# On Ruby/TkORCA, a canvas widget takes place of a pseudo window
# manager for slave Ruby/Tk applications.
-- 
Hidetoshi NAGAI (nagai / ai.kyutech.ac.jp)