Newbie question Canvas or frame

M

Mer Gilmartin

In ruby-tk

Do you need a canvas to show a picture or is it ok to
show a picture on a frame?

When should you use a canvas?
 
M

Mer Gilmartin

Mer said:
In ruby-tk
Do you need a canvas to show a picture or is it ok to
show a picture on a frame?
When should you use a canvas?

Ok. canvas is needed to display picture.
but i still would like to hear peoples comments about
canvases and frames to understand them better.
 
H

Hidetoshi NAGAI

From: Mer Gilmartin <[email protected]>
Subject: Newbie question Canvas or frame
Date: Tue, 10 Oct 2006 19:19:28 +0900
Message-ID: said:
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.
 
M

Mer Gilmartin

Hidetoshi said:
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).

Ah. Im using TkPhotoImage with canvas and a frame. Is this ok ?

And the `TkImg' extension, do I add that with require "TKImg".
I have active tcl on the computer.
 
H

Hidetoshi NAGAI

From: Mer Gilmartin <[email protected]>
Subject: Re: Newbie question Canvas or frame
Date: Tue, 10 Oct 2006 23:20:40 +0900
Message-ID: said:
Ah. Im using TkPhotoImage with canvas and a frame. Is this ok ?

That is OK, if that is what you want. :)
And the `TkImg' extension, do I add that with require "TKImg".
I have active tcl on the computer.

Please use "require 'tkextlib/tkimg'".
If your Ruby/Tk loads libraries of ActiveTcl, that will work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top