Welcome to Dream.In.Code
Getting Help is Easy!

Join 132,617 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 985 people online right now. Registration is fast and FREE... Join Now!




ruby images

 
Reply to this topicStart new topic

ruby images

Brunswick
post 8 May, 2006 - 04:55 PM
Post #1


New D.I.C Head

*
Joined: 8 May, 2006
Posts: 1


My Contributions


[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.
User is offlineProfile CardPM

Go to the top of the page

Amadeus
post 8 May, 2006 - 05:03 PM
Post #2


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 12,176



Thanked 33 times

Dream Kudos: 25
My Contributions


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
CODE

"C:\dir1\dir2\images\img1.gif"

or relatively
CODE

"../images/img1.gif"
User is offlineProfile CardPM

Go to the top of the page

roberts
post 10 Mar, 2007 - 10:58 PM
Post #3


New D.I.C Head

*
Joined: 10 Mar, 2007
Posts: 5


My Contributions


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.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 03:10AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month