2 Replies - 11798 Views - Last Post: 10 March 2007 - 11:58 PM Rate Topic: -----

#1 Brunswick  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 08-May 06

ruby images

Post icon  Posted 08 May 2006 - 05:55 PM

[FONT=Arial]
image1 = TkPhotoImage.new { file "img1.gif" }
image2 = TkPhotoImage.new { file "img2.gif" }


b = TkButton.new(@root) {
image image1
command proc { doit }
}


b.bind("Enter") { b.configure('image'=>image2) }
b.bind("Leave") { b.configure('image'=>image1) }

where in the hierarchy of files, say C:\ruby\lib, would I put the image for being used in my program?? Like where it says file? would i put there the path name to my image file.

Is This A Good Question/Topic? 0
  • +

Replies To: ruby images

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: ruby images

Posted 08 May 2006 - 06:03 PM

You'll specify the path right before the actual file name of your image...the example you have currently shown presumes that the image file is in the same directory as the script. You can either path absolutely
"C:\dir1\dir2\images\img1.gif"


or relatively
"../images/img1.gif"


Was This Post Helpful? 0
  • +
  • -

#3 roberts  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 10-March 07

Re: ruby images

Posted 10 March 2007 - 11:58 PM

hi,
I think this from book "Programming Ruby": Sample Code for page 260,

in this example, img1.gif and img2.gif at the same path of source code.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1