Description Usage Arguments Details Value Author(s) See Also Examples
Mechanism provided here is very simple and allows for automatic loading of image resources from any package subdirectory. Currently, only Tk images loaded from GIF files are supported... but more formats could be added in the future.
1 2 3 4 5 6 7 8 9 10 11 | imgAdd(file, type = "gif", img.type = "tkImage", update = FALSE, ...)
imgDel(image)
imgGet(image)
imgNames()
imgType(image, warn = TRUE)
imgRead(dir, type = "gif", img.type = "tkImage")
imgReadPackage(package, subdir = "gui", type = "gif", img.type = "tkImage")
## S3 method for class 'guiImg'
print(x, ...)
|
file |
image file from where to download the resource. |
type |
type of image. Currently, only 'gif' is supported. |
img.type |
the type of image resource to create. Currently, only 'tkImage' is supported and it is a Tcl/Tk resource. |
update |
do we update an already loaded image resource, or not? |
image |
Name of an image. |
warn |
do we issue a warning if the type of image is not recognized? |
dir |
the directory that contains one or more image files to read. |
package |
name of a package from where to load image resources. |
subdir |
subdirectory in the package where the graphical resources are stored. By default, it is the \"gui\" subdirectory. |
x |
an object of class 'guiImg'. |
... |
further arguments (currently not used). |
These functions care about (un)loading image resources. A list of these
resources is maintained in '.guiImgs' located in the SciViews:TempEnv
environment.
imgAdd()
and imgGet()
return the handle to the newly created
image (invisibly for the imgAdd()
).
imgDel()
returns invisibly TRUE
if the resource is found and
deleted, FALSE
otherwise.
imgNames()
return the list of all images registered in .guiImgs in the
SciViews:TempEnv
environment.
imgRead()
and imgReadPackage()
return invisibly the list of
image files that are imported as resources.
Philippe Grosjean
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## Not run:
## These cannot be run by examples() but should be OK when pasted
## into an interactive R session with the tcltk package loaded
imgNames()
myImg <- imgAdd(system.file("gui", "logoSciViews.gif", package = "svWidgets"))
myImg # Note that $Tk. is prepended to the name!
imgNames()
imgType(myImg)
## Place that logo in a Tk window
timg <- winAdd("timg", title = "A Tk window with image", pos ="-40+20")
labImg <- tklabel(timg, image = imgGet(myImg), bg = "white")
tkpack(labImg)
## When the image resource is deleted, it is not displayed any more (no error)
imgDel(myImg)
imgNames()
winDel("timg")
## To read all image resources at once (place this in .Lib.first())
imgReadPackage("svWidgets")
imgNames()
rm(myImg)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.