[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

tk image problem

Charles Hixson

6/1/2005 1:42:00 AM

When I attempt to read in xpm files created by the Gimp, I get
"/usr/lib/ruby/1.8/tk.rb:2020:in `__invoke': couldn't recognize data in
image file " errors. If it's a gif file, the program works without at
hitch.

It's just a simple test I threw together because I wanted to convert
another program from Gtk to Tk (so it would run on a stock Mac), but I
guess it's a somewhat decent example, so here goes:
(The image files would make this altogether too long, but they open in
the Gimp, in Konqueror, and in Mozilla without a hitch....Well, Mozilla
didn't handle it internally, but referred to an application called
display, which I'd never encountered before...but it was "sort of"
without a hitch. Apparently Mozilla doesn't recognize XPM files. And
the same was true of Konqueror, which really surprised me. But KView
and Kuickshow opened it without complaint.)

Does anyone have any ideas what's going on here?



require "tk"

# widget demo directory
cur_dir = File.dirname($0)
dat_dir = [cur_dir, "..", "data"].join(File::SEPARATOR)
top = TkRoot.new {title "Label and Entry Window"}

$setTopBackFlag = false
def setTopBack(t, b, image1, image2)
nxtColor = sprintf("\#%06x", rand(0xffff))
puts "nxtColor = #{nxtColor}"
$setTopBackFlag = !$setTopBackFlag
btnImage = $setTopBackFlag ? image1 : image2
t.configure("background"=>"#{nxtColor}")
b.configure("image"=>btnImage)
end

# add the label
lb1 = TkLabel.new(top) do
text "Hello World"
background "yellow"
foreground "blue"
place("relx"=>0.0, "rely"=>0.0)
end # lb1

# add the entry
e1 = TkEntry.new(top) do
background "red"
foreground "blue"
place("relx"=>0.5, "rely"=>0.93)
end # e1

# add a button
image1Fil = [dat_dir, "n3d.gif"].join(File::SEPARATOR)
image2Fil = [dat_dir, "n4d.gif"].join(File::SEPARATOR)
image1 = TkPhotoImage.new {file image1Fil}
image2 = TkPhotoImage.new {file image2Fil}
#image_w = TkPhotoImage.new
b1 = TkButton.new(top) do
text "submit"
image image1
command lambda{setTopBack(top, b1, image1, image2)}
place("relx"=>0.1, "rely"=>0.5)
end

Tk.mainloop
31 Answers

Hidetoshi NAGAI

6/1/2005 5:40:00 AM

0

Charles Hixson

6/1/2005 9:42:00 PM

0

Hidetoshi NAGAI wrote:

>From: Charles Hixson <charleshixsn@earthlink.net>
>Subject: tk image problem
>Date: Wed, 1 Jun 2005 10:41:50 +0900
>Message-ID: <429D11DA.4010906@earthlink.net>
>
>
>>When I attempt to read in xpm files created by the Gimp, I get
>>"/usr/lib/ruby/1.8/tk.rb:2020:in `__invoke': couldn't recognize data in
>>image file " errors. If it's a gif file, the program works without at
>>hitch.
>>
>>
>
>man n photo ;-)
>Standard Tk library supports PPM/PGM/GIF on photo images.
>If you want to treat XPM on Ruby/Tk, please use Tcl/Tk's Img extension.
>It adds supports for BMP/JPEG/PNG/XBM/XPM and so on.
>
>
That sounds like you know the right answer...but I don't understand it.
Can you point to any documentation of Tcl/Tk's Img extension? Google
produced some links, but they seem to be implying that this won't work
on a vanilla installation. (I'm not really certain, as they were really
talking about something else...but that's what it sounded like.) If
this is correct, then I guess I must convert all of my images to gif
files. (This isn't horrendous, but I prefer that the images be
something I can look at with a text editor.)



Hidetoshi NAGAI

6/2/2005 3:46:00 AM

0

Charles Hixson

6/2/2005 7:15:00 AM

0

Hidetoshi NAGAI wrote:

>From: Charles Hixson <charleshixsn@earthlink.net>
>Subject: Re: tk image problem
>Date: Thu, 2 Jun 2005 06:42:25 +0900
>Message-ID: <429E2B37.9040401@earthlink.net>
>
>
>>That sounds like you know the right answer...but I don't understand it.
>>Can you point to any documentation of Tcl/Tk's Img extension? Google
>>produced some links, but they seem to be implying that this won't work
>>on a vanilla installation.
>>
>>
>
>Official page of Img ext is <http://sourceforge.net/projects....
>README file of Img extension says "Not done yet" on Mac.
>---< from README file >------------
>PLATFORMS
> tested:
> Linux 2.0.30 (gcc, egcs)
> IRIX 6.2 (cc, 32 bits only)
> ULTRIX 4.1 (cc, gcc, egcs)
> ULTRIX 4.4 (cc 3.0)
> HP-UX-9 (cc, gcc, egcs)
> HP-UX-10.2 (gcc, egcs)
> SunOS-4.1.2 (cc)
> Solaris 2.5 (gcc, egcs)
> FreeBSD 2.2 (gcc, egcs)
> Windows 95/98/NT(gcc-2.95/MS Visual C++ 4.2/5.0/6.0)
>
> Not done yet:
> Mac ) someone interested
> VMS ) to try??????
>
> Other machines and OS's should work too.
>-----------------------------------
>However, source archive of Img ext includes "imgMacProject.sit.hqx"
>and "pkgIndex.mac".
>Although I don't know about Mac, I think that it possibly work on Mac.
>
># If about Tcl/Tk Aqua <http://tcltkaqua.sourceforg..., its binary
># distribution includes Img ext.
>
>I'm sorry that I cannot show enough information.
>
>
No real problem. Gifs will work fine, I just prefer xpms.



topcat

7/23/2011 4:53:00 PM

0


"sittingduck" <duck@spamherelots.com> wrote in message
news:Xns9F2B63660D71Bduckrulestheuniverse@nomail.afraid.org...
> topcat wrote:
>
>>
>> "Jack" <Jack@noway.com> wrote in message news:j0eq7n$9hv$1@dont-
> email.me...
>>> Fact
>>
>>
>> FACT - 50% of people pay 96% of the taxes
>>
>> FACT - The other 50% pay 4%, that would be YOU.
>>
>> FACT - LIBERALS have thrown the US into financial ruin by their social
>> re-engineering (Community Reinvestment ACT) and their need to fund the
>> welfare state and entitlement addiction for the last 50 YEARS.
>
> Rightards and republicans routinely refuse reality.
>
>

Hmmm....personal attacks in place of an actual argument....another typical
liberal tactic. (Note to my conservative friends....I will shortly be called
a racist or be compared to Hitler, see page 1 of the liberal handbook)

TC


Siobhan Medeiros

7/23/2011 5:25:00 PM

0

On Jul 23, 8:51 am, "topcat" <top...@aboy.com> wrote:
> "Jack" <J...@noway.com> wrote in messagenews:j0eq7n$9hv$1@dont-email.me...
> > Fact
>
> FACT - 50% of people pay 96% of the taxes

Wrong. And irrelevant.

>
> FACT - The other 50% pay 4%, that would be YOU.
>

Wrong.


> FACT - LIBERALS have thrown the US into financial ruin by their social
> re-engineering (Community Reinvestment ACT) and their need to fund the
> welfare state and entitlement addiction for the last 50 YEARS.
>

Wrong. That idiotic theory has been debunked over and over again.


> TC

Citizen Jimserac

7/23/2011 5:35:00 PM

0

On Jul 23, 1:25 pm, Siobhan Medeiros <shanbo1...@gmail.com> wrote:
> On Jul 23, 8:51 am, "topcat" <top...@aboy.com> wrote:
>
> > "Jack" <J...@noway.com> wrote in messagenews:j0eq7n$9hv$1@dont-email.me....
> > > Fact
>
> > FACT - 50% of people pay 96% of the taxes
>
> Wrong.  And irrelevant.
>
>
>
> > FACT - The other 50% pay 4%, that would be YOU.
>
> Wrong.
>
> > FACT - LIBERALS have thrown the US into financial ruin by their social
> > re-engineering (Community Reinvestment ACT) and their need to fund the
> > welfare state and entitlement addiction for the last 50 YEARS.
>
> Wrong.  That idiotic theory has been debunked over and over again.

Correct ! The Repubs are living in a fantasy world where everyone is
a business person, the money is flowing and everyone flies a corporate
jet, has 3 homes with the juniors all going to Ivy League schools.
Note that what they call "entitlements" was paid for by taxes and
paycheck deductions for a lifetime of work by many people getting the
"entitlements".

The moment they are confronted with the real world, there is a mental
blackout. It is like they become simpleminded. They can't abide by
the thought of them paying for "everyone's" healthcare but are OK with
the rampant profiteering of the "healthcare insurers" and with
millions of people using the emergency rooms of our nations' hospitals
for routine medical care instead of having a plan that prepares for
and includes them. Then the taxes to pay for all that get spread to
the middle class and below while the Repubs use loopholes to avoid and
evade their share.

Repubs sure are good at evading things they claim are unfair to them.
It's always someone else that needs to share the burden, NOT THEM.

Repub DOUBLETALK only goes so far and falls to the ground when
confronted with FACTS.

GANG OF 100 MILLION
(We ARE watching. Wait and see on election day!!)

The PHANTOM

7/23/2011 6:05:00 PM

0

On Jul 23, 10:51 am, "topcat" <top...@aboy.com> wrote:
> "Jack" <J...@noway.com> wrote in messagenews:j0eq7n$9hv$1@dont-email.me...
> > Fact
>
> FACT - 50% of people pay 96% of the taxes
>
> FACT - The other 50% pay 4%, that would be YOU.
>
> FACT - LIBERALS have thrown the US into financial ruin by their social
> re-engineering (Community Reinvestment ACT) and their need to fund the
> welfare state and entitlement addiction for the last 50 YEARS.
>
> TC

You left out: 47% pay ZERO federal taxes

topcat

7/23/2011 6:13:00 PM

0


"Siobhan Medeiros" <shanbo1926@gmail.com> wrote in message
news:8cf1a9f4-122c-4a34-869d-8d90ec04c2df@u28g2000prm.googlegroups.com...
On Jul 23, 8:51 am, "topcat" <top...@aboy.com> wrote:
> "Jack" <J...@noway.com> wrote in messagenews:j0eq7n$9hv$1@dont-email.me...
> > Fact
>
> FACT - 50% of people pay 96% of the taxes

Wrong. And irrelevant.

>
> FACT - The other 50% pay 4%, that would be YOU.
>

Wrong.


> FACT - LIBERALS have thrown the US into financial ruin by their social
> re-engineering (Community Reinvestment ACT) and their need to fund the
> welfare state and entitlement addiction for the last 50 YEARS.
>

Wrong. That idiotic theory has been debunked over and over again.


> TC

LOL! Let me give you the liberal definition of "debunked" - liberals LYING
about the issue.

http://online.wsj.com/article/SB1103766519523...

Next.

TC



topcat

7/23/2011 6:19:00 PM

0


"The PHANTOM" <hoofhearted07@yahoo.com> wrote in message
news:f3ce4bcf-c4e2-473e-b149-3ff6d497d1d4@p20g2000yqp.googlegroups.com...
On Jul 23, 10:51 am, "topcat" <top...@aboy.com> wrote:
> "Jack" <J...@noway.com> wrote in messagenews:j0eq7n$9hv$1@dont-email.me...
> > Fact
>
> FACT - 50% of people pay 96% of the taxes
>
> FACT - The other 50% pay 4%, that would be YOU.
>
> FACT - LIBERALS have thrown the US into financial ruin by their social
> re-engineering (Community Reinvestment ACT) and their need to fund the
> welfare state and entitlement addiction for the last 50 YEARS.
>
> TC

You left out: 47% pay ZERO federal taxes

******

Yeah, and they vote to have you and me pay for things for them.

TC