Description Usage Arguments Value Author(s) References Examples
A progress bar that shows the status of long-running operations.
1 2 3 4 | ProgressBar(win.title = "Progress Bar", label = "", maximum = 100,
nsteps = NULL, min.nsteps = 10L, parent = NULL)
SetProgressBar(pb, value, label = NULL, step = NULL)
|
win.title |
character. String to display as the title of the dialog box. |
label |
character. String to display in the dialog box. |
maximum |
numeric. Maximum value for the progress bar. The minimum value is zero. |
nsteps |
numeric. Total number of increments the progress bar will make. |
min.nsteps |
numeric.
Minimum number of increments.
If greater than |
parent |
tkwin. graphical user interface parent window |
pb |
ProgressBar.
Object returned from |
value |
numeric.
Value for the progress bar, between zero and |
step |
numeric.
Number of progress bar increments.
If equal to |
For ProgressBar
an object of class "ProgressBar"
and mode list
is returned.
Components of the list object include:
GetValue |
function that returns the value of the progress bar. |
MoveProgressBar |
function that moves progress bar, passes a numeric argument. |
SetLabel |
function that sets label in the dialog box, passes a character argument. |
DestroyWindow |
function that closes the dialog box. |
GetWindowState |
function that returns false if the dialog box has been closed, otherwise true. |
nsteps |
see ‘Arguments’ section |
For SetProgressBar
, the previous value of the progress bar.
An error is returned if the progress has terminated prematurely.
J.C. Fisher, U.S. Geological Survey, Idaho Water Science Center
The code in this function was derived from the tkProgressBar
function, version v3.0.2.
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Not run:
maximum <- 10
label <- "Estimated time to completion is being calculated\u2026"
pb <- ProgressBar(label = label, maximum = maximum, nsteps = maximum)
for (i in seq_len(maximum)) {
est.time <- system.time(Sys.sleep(1))["elapsed"] * (maximum - i)
label <- paste("Estimated time to completion is", round(est.time), "secs")
ans <- try(SetProgressBar(pb, value = i, label = label, step = i))
if (inherits(ans, "try-error")) break
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.