开发者

How to hide TclTk window in R while it is being drawn

TclTk is working fine in R, it's just that I can see the widgets being placed on the window as it is being built. Is there a way to hide the window, and only show it once it is built? Paste the following into R and you'll see the window filling 开发者_运维问答up. That's what I don't want user to see (if possible). Thanks.

require(tcltk)
dlg = tktoplevel()
# command to hide window ?
for (i in 1:10) {
    l = list()
    for (i in 1:20) l[[i]]=tkbutton(dlg,text="SO")
    do.call(tkgrid,l)
}
# command to show window now it is built ?
tkwait.window(dlg)
tkdestroy(dlg)


I have the following pattern in gWidgetstcltk:

library(tcltk)
tclServiceMode(FALSE)
win <- tktoplevel()
tkwm.state(win,"withdrawn") 
tclServiceMode(TRUE)

## ... do your thing then:
tkwm.state(win,"normal")


You can just wrap the whole thing in curly braces. That's worked for me so far.

Something like:

{ # Begin building window
  (code)
} # End building window
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜