1
`win <- gwindow(title = "Analysing PDB structures", visible=TRUE, name=title,
width = NULL, height = NULL, parent=NULL)
group <- ggroup(horizontal = FALSE, container=win)
obj <- glabel("Type your PDB code here:", container = group)
obj <- gedit("", container=group)
obj <- gbutton("Go", container = group)`
當用戶向gedit輸入一個值並按下gbutton「Go」時,如何獲得後續代碼(例如install.packages(bio3d))以自動運行?如何爲gWidget提供功能以及如何利用用戶輸入到'gedit'中的輸入?
編輯:在回覆帖子我設法工作的功能,謝謝。 如何在obj3的obj2中的'gedit'中使用用戶提供的輸入?我究竟做錯了什麼?
win <- gwindow(title = "Analysing PDB structures",
visible=TRUE, name=title,
width = NULL, height = NULL, parent=NULL)
group <- ggroup(horizontal = FALSE, container=win)
obj1 <- glabel("Type your PDB code here:", container = group)
innergroup <- ggroup(container = group)
obj2 <- gedit((file1<-""), container=innergroup)
obj3<-addHandlerChanged(obj2, handler=function(...){
gbutton("Go", container = innergroup,
handler = function(h, ...) {
gmessage(svalue(obj2), title = (pdb<- read.pdb(file1)))
})
})