Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

gtimer

Basic timer widget


Description

Calls FUN every ms/1000 seconds. A timer is stopped through its stop_timer method which is called using OO style: obj$stop_timer().

S3 generic for dispatch

Usage

gtimer(ms, FUN, data = NULL, one.shot = FALSE, start = TRUE,
  toolkit = guiToolkit())

.gtimer(toolkit, ms, FUN, data = NULL, one.shot = FALSE, start = TRUE)

Arguments

ms

interval in milliseconds

FUN

FUnction to call. Has one argument, data passed in

data

passed to function

one.shot

logical. If TRUE, called just once, else repeats

start

logical. If FALSE, started by start_timer OO method. (Call obj$start_time()).

toolkit

gui toolkit to dispatch into

Examples

## Not run: 
i <- 0
FUN <- function(data) {i <<- i + 1; if(i > 10) a$stop_timer(); print(i)}
a <- gtimer(1000, FUN)
##
## a one shot timer is run only once
FUN <- function(data) message("Okay, I can breathe now")
hold_breath <- gtimer(1000*60, FUN, one.shot=TRUE)

## End(Not run)

gWidgets2

Rewrite of gWidgets API for Simplified GUI Construction

v1.0-8
GPL (>= 3)
Authors
John Verzani
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.