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)))
})
})