… this creates an image that can be saved in different formats.
The ruby solution probably looks very similar.
Could you give me a hand with this, please?
I cannot test it, because my Tk doesn’t support ‘window’ format.
Neither does mine, it seems, but …
ph = TkPhotoImage.new(‘format’=>‘gif’,‘data’=>@hjgjkgjg) #nonsense data
gives this (inspect):
#<TkPhotoImage:0x8fc93f0 @path=“i00000”, @type=“photo”>
So it “seems” to work, but …
ph = TkPhotoImage.new(‘format’=>‘gif’, ‘data’=>@can) #data: my canvas
leads to: “couldn’t recognize image data”. Same for ‘data’=>@can.path
From: Ralf lausianne@gmx.net
Subject: Re: How to save Tk canvas as picture/create image from canvas?
Date: Fri, 31 Jan 2003 23:25:25 +0900
Message-ID: 3e3a57af$1@epflnews.epfl.ch
So it “seems” to work, but …
ph = TkPhotoImage.new(‘format’=>‘gif’, ‘data’=>@can) #data: my canvas
leads to: “couldn’t recognize image data”. Same for ‘data’=>@can.path
That is a right result.
I think you can give a canvas widget path as a ‘data’ option value
when you give ‘window’ as a ‘format’ option value.
So it “seems” to work, but …
ph = TkPhotoImage.new(‘format’=>‘gif’, ‘data’=>@can) #data: my canvas
leads to: “couldn’t recognize image data”. Same for ‘data’=>@can.path
That is a right result.
I think you can give a canvas widget path as a ‘data’ option value
when you give ‘window’ as a ‘format’ option value.
This is what I tried first, but …
$!: image format “window” is not supported 8(
From: Ralf lausianne@gmx.net
Subject: Re: How to save Tk canvas as picture/create image from canvas?
Date: Mon, 3 Feb 2003 18:13:19 +0900
Message-ID: 3e3e31d3$1@epflnews.epfl.ch
I think you can give a canvas widget path as a ‘data’ option value
when you give ‘window’ as a ‘format’ option value.
This is what I tried first, but …
$!: image format “window” is not supported 8(
I thought your Tcl/Tk already supported the option.
Well, first of all, you must let your Tcl/Tk supports the option.
If the option is supported by Tcl/Tk ext library,
you must load the library on your Ruby/Tk by TkPackage module.
If the Tcl/Tk ext library only add support of new formats,
probably you don’t need to define new classes for Ruby/Tk.
This is what I tried first, but …
$!: image format “window” is not supported 8(
I thought your Tcl/Tk already supported the option.
Well, first of all, you must let your Tcl/Tk supports the option.
If the option is supported by Tcl/Tk ext library,
you must load the library on your Ruby/Tk by TkPackage module.
If the Tcl/Tk ext library only add support of new formats,
probably you don’t need to define new classes for Ruby/Tk.
???
Sorry, Sir, but you probably can’t imagine, how confused a Windows person can be
in a Unix world.
So I spent some time on this, managed (not sure about this) to install tkext,
but now I don’t know what to do with it. The tkext test scripts don’t run,
because I don’t have tix, and I wasn’t able to find out how to get it (… Unix
world).
What is this TkPackage module? I found something here: http://www.eng.dmu.ac.uk/~hgs/ruby/ruby-1.6.7-rdocs/classes/TkPackage.html
… but didn’t understand it.
I’m progressing well with my application, only without being able to export the
result (the picture on the canvas), it is all useless. So it is really important
for me to find a solution. Seems like I reaaly depend on your support, strangely
enough.
Thank you!
cheers, Ralf.
From: Ralf lausianne@gmx.net
Subject: Re: How to save Tk canvas as picture/create image from canvas?
Date: Tue, 4 Feb 2003 22:13:15 +0900
Message-ID: 3e3fb939$1@epflnews.epfl.ch
I thought your Tcl/Tk already supported the option.
Well, first of all, you must let your Tcl/Tk supports the option.
If the option is supported by Tcl/Tk ext library,
you must load the library on your Ruby/Tk by TkPackage module.
If the Tcl/Tk ext library only add support of new formats,
probably you don’t need to define new classes for Ruby/Tk.
???
Sorry, Sir, but you probably can’t imagine, how confused a Windows person
can be in a Unix world.
So I spent some time on this, managed (not sure about this) to install tkext,
but now I don’t know what to do with it. The tkext test scripts don’t run,
because I don’t have tix, and I wasn’t able to find out how to get it (…
Unix world).
No, no, no. In this case, you don’t need tcltk-ext library.
For testing new image format, I installed Tcl/Tk8.4.1 and
Img 1.2.4 (Tk extend library; This supports ‘-format window’).
First, I tested that the Img library works correctly with Tcl/Tk8.4.1.
And next, compiled tcltklib with libtcl8.4.so/libtk8.4.so.
Now, Tcl/Tk8.4.1 works with Ruby 1.6.8,
and the following script (part) works fine.
require ‘tk’
TkPackage.require(‘Img’, ‘1.2’)
c = TkCanvas.new.pack
Because I failed to compile Img library with Tcl/Tk on my environment,
I had to install a new verison of Tcl/Tk.
But if your Tcl/Tk is supported by the DLL of Img library on Wndows,
you will have no need to compile Tcl/Tk or the library.
You will be able to get Img DLL for Windows on Img developer’s web page.
I think it is not so difficult.
What is this TkPackage module?
It is defined on tk.rb.
It supports Tcl’s package command which can load dynamic libraries
of several Tcl/Tk extend libraries to normal Tcl/Tk.
No, no, no. In this case, you don’t need tcltk-ext library.
For testing new image format, I installed Tcl/Tk8.4.1 and
Img 1.2.4 (Tk extend library; This supports ‘-format window’).
I think it is not so difficult.
Not for you, certainly
It still took me some time. Only problem left now, for me it only works for gif
(which is ok for the moment). Somehow the other dll’s are not found. They are in
"C:\Program Files\ruby\tcl\bin", but moving them somewhere else (Windows system
directory, home of most other dll’s) doesn’t help.
Anyway, thank a lot!
Cheers, Ralf.
From: Ralf lausianne@gmx.net
Subject: Re: How to save Tk canvas as picture/create image from canvas?
Date: Wed, 5 Feb 2003 17:26:32 +0900
Message-ID: 3e40c968$1@epflnews.epfl.ch
It still took me some time. Only problem left now, for me it only works
for gif (which is ok for the moment). Somehow the other dll’s are not
found. They are in "C:\Program Files\ruby\tcl\bin", but moving them
somewhere else (Windows system directory, home of most other dll’s)
doesn’t help.
for gif (which is ok for the moment). Somehow the other dll’s are not
found. They are in "C:\Program Files\ruby\tcl\bin", but moving them
Doesn’t the binary archive on http://www.xs4all.nl/~nijtmans/img.html
include DLLs for other formats?
Yes, it does, in the folder I mentioned, but they are not found there or
elsewhere …
I thought it was a path problem, maybe it is. I keep trying.
Cheers, Ralf.