[R] bitmap images in tcltk

Roger Bivand Roger.Bivand at nhh.no
Tue May 6 20:44:56 CEST 2003


On Tue, 6 May 2003, John Fox wrote:

> Dear R-help list members,
> 
> I'm writing a package using tcltk. Thanks to Peter Dalgaard's excellent 
> work on the tcltk package, almost everything has gone very smoothly. I'm 
> stymied, however, by the following problem:
> 
> I want to incorporate a bitmap image, stored as an xbm file, in a widget. 
> To take a simple example,
> 
>      top <- tktoplevel()
>      tkgrid(tklabel(top, bitmap="@file.xbm", fg="red"))
> 
> will work as long as file.xbm is in the current directory; alternatively, I 
> could specify the path to this file. The problem is that I can't figure out 
> a reliable way of predicting (or discovering) where the bitmap file will 
> reside when my package is installed.
> 
> Any suggestions would be appreciated.

system.file(<file path relative to package root>, package="package")[1]

should do it.

> 
> Thanks,
>   John
> -----------------------------------------------------
> John Fox
> Department of Sociology
> McMaster University
> Hamilton, Ontario, Canada L8S 4M4
> email: jfox at mcmaster.ca
> phone: 905-525-9140x23604
> web: www.socsci.mcmaster.ca/jfox
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no




More information about the R-help mailing list