我退出应用程序时,我的R tcltk
应用程序连接无法顺利关闭。单击“关闭会话”按钮后,R会话将中止。任何帮助表示赞赏。谢谢!
library(tcltk)
library(methods)
tt <- tktoplevel()
tkwm.title(tt, "First window")
done <- tclVar(0) # done = 0 if window is active; done = 1 if window has been closed, done = 2 if window has been closed using cancel or destroyed
# build quit button ----
quitButton <- tkbutton(tt, text = "Close Session",
command = function() {
quit(save = "no")
tkdestroy(tt)
}
)
# construct visual grid ----
tkgrid(quitButton,
pady= 2.5, padx= 1)
tkwait.variable(done)