gwidgets gtable refresh

ぃ、小莉子 提交于 2019-12-04 03:14:39

To expand upon John's answer, here's an example.

#Data
cc <- data.frame(aa = 1:3, bb = 4:6)
dd <- data.frame(X = 7:9)

#Wigdets
win <- gwindow()
grp <- ggroup(container = win)
t1 <- gtable(cc, container = grp)

#Refresh widget
delete(grp, t1)
t1 <- gtable(dd, container = grp)

Note that the sample code in the question works fine under gWidgetstcltk; it's a purely GTK issue.

The gtk widget makes you pick the type of column at construction, so gtable doesn't let you have fewer columns or change column types. If you really want to do this, put the widget in a ggroup container, then delete and add a new widget.

If it is only about refreshing instead of completely changing its content I made very nice experience with something like this:

win <- gtable(data.frame(a=rnorm(100),b=runif(100)),container=T)
win[1,1] <- 5
win[1:10,2] <- 6
win[seq(dim(win)[1]),seq(dim(win)[2])] <- win[seq(dim(win)[1]),seq(dim(win)[2])] +1 

a complete 'refresh' might look like this:

win <- gtable(data.frame(a=rnorm(100),b=runif(100),d=FALSE),container=T)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!