rp.button | R Documentation |
This function adds a button to the panel. A nominated function is called when the button is pressed.
rp.button(panel, action = I, title=deparse(substitute(action)), repeatdelay=0, repeatinterval=0, quitbutton=FALSE, pos=NULL, foreground=NULL, background=NULL, font=NULL, parentname=deparse(substitute(panel)), name=paste("button", .nc(), sep=""), ...)
panel |
the panel in which the button should appear. |
action |
the function executed when the button is pressed. |
title |
the text displayed on the button. |
repeatinterval |
the interval between auto-repeats (milliseconds) when the button is held down. |
repeatdelay |
the time after which the button starts to auto-repeat (milliseconds). |
quitbutton |
this defaults to FALSE. Set to TRUE this creates a button which will close the window and escape from an rp.block call. Before the window is destroyed the action function will be called. |
pos |
the layout instructions. Please see the |
foreground |
this sets the colour of text e.g. "navy" |
background |
this sets the background colour of text e.g. "white" |
font |
this sets the text font e.g. "Arial" |
parentname |
this specifies the widget inside which the button should appear. |
name |
the name of the button. |
... |
... |
The function action
should take one argument, which should be the panel.
See rp.grid
for details of the grid layout system.
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.
The arguments id
and parent
have been discontinued in version 1.1.
rpanel: Simple interactive controls for R functions using the tcltk package. Journal of Statistical Software, 17, issue 9.
rp.doublebutton
,rp.control
## Not run: # This function will be called on pressing the button "Simulate". boxp.sim <- function(panel) { boxplot(rnorm(50)) panel } # Create an rpanel and add the button "Simulate" to it. panel <- rp.control() rp.button(panel, action = boxp.sim, title = "Simulate") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.