How do you create your status line at the bottom of your window? An inactive entry does not look very nice. What other options are there?
Is possible to integrate a progress bar which is visible only on demand?
(I am using tk and ttk from within R.)
EDIT: Now here is my second version, which works fine for me, but I would like to display the whole status bar on demand only (similar to what the status bar in the Chrome browser does). How can I do that? Calling tklower(f) does not help...
library(tcltk)
library(tcltk2)
tkdestroy(root)
root <- tktoplevel()
status <- tclVar("")
progress <- tclVar("0")
b <- tk2button(root, text="fake doing something!")
tkpack(b, padx=40, pady=10)
o <- tk2checkbutton(root, text="show progress", variable=progress)
tkpack(o, pady=10)
f <- tk2frame(root, relief="sunken")
l <- tk2label(f, textvariable=status)
tkpack(l, side="left", pady=2, padx=5, expand=0, fill="x")
tkpack(f, side="left", expand=1, fill="x", anchor="s")
sg <- ttksizegrip(root)
tkpack(sg, side="left", expand=0, anchor="se")
doit <- function() {
tclvalue(status) <- "working (hard) ..."
tcl("update")
do.pb <- tclvalue(progress)=="1"
if(do.pb) {
pb <- tk2progress(f, length=60, mode="determinate")
tkpack(pb, side="right", expand=0, padx=3, pady=2)
tkconfigure(pb, maximum=100, value=0)
}
for(i in 1:100) {
if(do.pb) {
tkconfigure(pb, value=i)
tcl("update")
}
Sys.sleep(0.03)
}
if(do.pb) tkdestroy(pb)
tclvalue(status) <- "Ready."
}
tkconfigure(b, command=doit)
tclvalue(status) <- "Ready."