Quantcast

Display image in tcl/tk information window: path to file ?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Display image in tcl/tk information window: path to file ?

Ulrike Grömping
Dear DevelopeRs,

for an R-Commander plugin, I want to display a pre-stored information image, if the user presses a button. Everything works fine with the command

tcl("image",  "create", "photo", "MaxC2.image", file="MaxC2res3image.gif")

for image creation, as long as the file entry refers to the correct location of the file on my hard drive. How can I make this portable ?

I currently have the image stored in the inst directory. "R CMD INSTALL --build" moves it to the top directory in the zip file. I have no idea how to tell R (or tcl) where to look for the file. Any help is appreciated!

Best regards,
Ulrike

*************
Ulrike Groemping
BHT Berlin

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Display image in tcl/tk information window: path to file ?

Romain Francois
?system.file

for example (if the file lives in inst/images of your source package)

system.file( "images", "MaxC2res3image.gif", package = "yourpackage" )

Romain

On 09/17/2009 02:09 PM, Ulrike Groemping wrote:

> Dear DevelopeRs,
>
> for an R-Commander plugin, I want to display a pre-stored information image,
> if the user presses a button. Everything works fine with the command
>
> tcl("image",  "create", "photo", "MaxC2.image", file="MaxC2res3image.gif")
>
> for image creation, as long as the file entry refers to the correct location
> of the file on my hard drive. How can I make this portable ?
>
> I currently have the image stored in the inst directory. "R CMD INSTALL
> --build" moves it to the top directory in the zip file. I have no idea how
> to tell R (or tcl) where to look for the file. Any help is appreciated!
>
> Best regards,
> Ulrike
>
> *************
> Ulrike Groemping
> BHT Berlin


--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/yw8E : New R package : sos
|- http://tr.im/y8y0 : search the graph gallery from R
`- http://tr.im/y8wY : new R package : ant

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Display image in tcl/tk information window: path to file ?

John Fox
In reply to this post by Ulrike Grömping
Dear Ulrike,

If I understand correctly what you want to do, the image file is stored in
your package. If so, you can use the .path.package() function to locate your
package on the file system. For example, the Rcmdr uses the following code
to find its etc subdirectory: file.path(.path.package(package="Rcmdr")[1],
"etc").

I hope this helps,
 John

------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox


> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]]
On
> Behalf Of Ulrike Groemping
> Sent: September-17-09 8:10 AM
> To: [hidden email]
> Subject: [Rd] Display image in tcl/tk information window: path to file ?
>
>
> Dear DevelopeRs,
>
> for an R-Commander plugin, I want to display a pre-stored information
image,
> if the user presses a button. Everything works fine with the command
>
> tcl("image",  "create", "photo", "MaxC2.image", file="MaxC2res3image.gif")
>
> for image creation, as long as the file entry refers to the correct
location

> of the file on my hard drive. How can I make this portable ?
>
> I currently have the image stored in the inst directory. "R CMD INSTALL
> --build" moves it to the top directory in the zip file. I have no idea how
> to tell R (or tcl) where to look for the file. Any help is appreciated!
>
> Best regards,
> Ulrike
>
> *************
> Ulrike Groemping
> BHT Berlin
>
>
> --
> View this message in context:
http://www.nabble.com/Display-image-in-tcl-tk-
> information-window%3A-path-to-file---tp25490113p25490113.html
> Sent from the R devel mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Loading...