[R] Need suggestions about GUI

j verzani jverzani at gmail.com
Tue Jan 22 03:08:59 CET 2008


ronggui <ronggui.huang <at> gmail.com> writes:

> Thanks.
> 
> gWidgets is quite good. However, I want to get the selection text chunk as
> well as the index, but the index arguments does not work for gtext.
> 
> > obj<-gtext(cont=T)
> > svalue(obj,drop=T)
> [1] "cde"
> > svalue(obj,drop=T,index=T)
> [1] "cde"
> 



The svalue method has the index argument for the widgets where you might want to
return the  index or value such with a radio button group or combobox. For
gtext, the drop argument when TRUE returns just the text selected by the mouse,
otherwise the entire text buffer is returned. 

library(gWidgets)
options("guiToolkit"="RGtk2")
obj = gtext("sadfsad",cont=T)
svalue(obj)   ## returns: "sadfsad\n"
svalue(obj,drop=TRUE)  ## returns  ""
## now highlight some text
svalue(obj,drop=TRUE) ## returns "dfsa"

If you want to email me a bit more detail as to what you are trying to do, I can
let you know if gWidgets can work for you.

--John
> 

> 2008/1/21, Gabor Grothendieck <ggrothendieck <at> gmail.com>:
> >
> > You can find examples of using tcltk here:
> >
> > http://www.sciviews.org/_rgui/tcltk/
> >
> > Also the gwidgets package is a toolkit independent
> > layer that can run on top of tcltk or RGtk and it is described
> > with many examples here:
> >
> > http://wiener.math.csi.cuny.edu/pmg/gWidgets
> >
> > On Jan 21, 2008 4:02 AM, ronggui <ronggui.huang <at> gmail.com> wrote:
> > > What I want to do is:
> > > 1, creat a text box, insert text into that box.
> > > 2, select chunk of of the text by mouse, and link it to a lable. so I
> > would
> > > like a way to get that chunk of text.
> > >
> > > Can I do such job with tcltk?  Any relavant tutorial materials?
> > >
> > > Thanks
> > >
> > > --
> > > HUANG Ronggui
> > >
> > > Bachelor of Social Work, Fudan University, China
> > >
> > > Master of sociology, Fudan University, China
> > >
> > > Ph.D. Student , CityU of HK,
> > >
> > http://www.cityu.edu.hk/sa/psa_web2006/students/rdegree/huangronggui.html
> > >
> > >        [[alternative HTML version deleted]]
> > >
> > > ______________________________________________
> > > R-help <at> r-project.org mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html
> > > and provide commented, minimal, self-contained, reproducible code.
> > >
> >
>



More information about the R-help mailing list