Skip to content

[R-gui] tkbutton() function call problem

2 messages · Robson, Samuel, Peter Dalgaard

#
Robson, Samuel wrote:
It's not happening for me (SuSE Linux 10.2). I don't see anything until
the loop is finished, though, which is as it should be since nothing
allows the event loop to process events (a tcl("update","idletasks") in
the loop fixes that) .

The coding is a bit odd in that you regenerate the counter variable on
each iteration, which is not the Intended Way. Rather, it is

foo <- function() {
    counter <- tclVar(0)
    tkconfigure(progressLabel, textvariable=counter)

   for (i in 1:1000) {
        tclvalue(counter) <- as.character(as.numeric(tclvalue(counter))+1)
     }	
}