关闭tcltk应用程序后R会话异常终止

时间:2019-04-10 19:31:15

标签: r tcltk

我退出应用程序时,我的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)

0 个答案:

没有答案