rp.image {rpanel}R Documentation

Placement of an image within a rpanel

Description

An image is placed inside a panel. When the image is clicked the action function is called with the x and y coordinates of the clicked position.

Usage

rp.image(panel, filename, action = I, id = "", parent = window, pos = NULL)

Arguments

panel the panel in which the image should appear. This may be passed as a panelname string or the panel object itself.
filename the name of the file where the image is located.
action the function which is called when the image is clicked.
id the name of the image.
parent this specifies the widget inside which the image should appear. In the current version of rpanel, it should not normally be used.
pos the layout instructions. Please see the rp.pos example and help for full details.

Details

The function action should take three arguments, the panel and the coordinates x and y where the image was clicked. At present only GIF images are supported.

Value

If the parameter panel is the panelname string the same string is returned. If the panel object is used the altered panel is assigned to both the calling level and global level.

Warning

The action function should return the panel. Without this assignment any widgets added or alterations made to panel parameters within the action function will be lost.

References

rpanel: Simple interactive controls for R functions using the tcltk package (http://www.stats.gla.ac.uk/~adrian/research-reports/rpanel.ps)

See Also

rp.control

Examples

gulls.click <- function(panel, x, y) {
  print(c(x, y))
  panel
}
panel <- rp.control()
image.file <- file.path(system.file(package = "rpanel"), "images", "gulllmks.gif")
rp.image(panel, image.file, id = "gulls.image", action = gulls.click)

[Package rpanel version 1.0-3 Index]