[R-gui] tutorial on gwidgets?

john verzani jverzani at gmail.com
Wed Aug 6 16:18:55 CEST 2008


Dear Tamas and Michael,

Michael Lawrence <mflawren <at> fhcrc.org> writes:

> 
> On Wed, Aug 6, 2008 at 4:46 AM, Antje <niederlein-rstat <at> yahoo.de> wrote:
> 
> > Hi Tamas,
> >
> > thanks a lot for your answer.
> >
> >> Hi,
> >>
> >> I would recommend to explore
> >> http://wiener.math.csi.cuny.edu/pmg/gWidgets
> >> especially the Examples section:
> >> http://wiener.math.csi.cuny.edu/pmg/gWidgets/Examples
> >> and the useR!2007 presentation:
> >> http://wiener.math.csi.cuny.edu/pmg/gWidgets/useR2007_presentation.pdf
> >> I hope it helps.
> >>
> >

SO far that's the documentation. I hope sometime to improve on it, but keep
getting distracted. The latest one was gWidgetsWWW. My todo list for gWidgets is
to rewrite the Rd files to better specify the API.  The comment about R-wiki
being way out of date is likely true. I haven't put any efforts into keeping
that up.

> > These tutorials I already found but still I don't know how to create a
> > flexible layout. For example (simple one), I'd like to have a window with a
> > text field with fixed width on the one side (stretched over the whole
> > height) and on the remaining right side, I'd like to put a button with a
> > fixed height but width adjustet to the remaining space of the window.
> >
> > This code would not give me the layout I'd like to see and I don't know how
> > to do it (even with the tutorials mentioned)
> >
> > <pre>
> > mainwin <- gwindow(title = "TestApplication", visible = TRUE, name=title)
> > splitgroup <- ggroup(horizontal=TRUE, container=mainwin)
> >
> > gtext(text = "Here we go", width = 150, container=splitgroup)
> > gbutton("push me", container = splitgroup, expand = TRUE)
> > size(mainwin) <- c(500,500)
> > </pre>
> >
> > I don't even know if there is any way to do what I want...
> >
> 
> It looks to me that the thing missing there is the vertical squashing of the
> button on the right side. To do that, you'll want to use a vertical group on
> the right side i.e. ggroup(horizontal=FALSE, container = splitgroup). Then
> make the button not expand (in a vertical group it will always expand
> horizontally), gbutton("push me", container = rightgroup, expand = FALSE).
> 

The buttons in RGtk2 always expand in one direction. To prevent that, a kludge
is to place them in a group as Michael says. If you really want a horizontal
group, you can nest groups:


mainwin <- gwindow(title = "TestApplication 2", visible = TRUE, name=title)
splitgroup <- ggroup(horizontal=TRUE, container=mainwin)

gtext(text = "Here we go", width = 150, container=splitgroup)
g = ggroup(horizontal=FALSE, expand=FALSE,container = splitgroup)
gbutton("push me", container = g)
size(mainwin) <- c(500,500)


> I think that should help. The problem I have with gWidgets is that the
> button labels seem misjustified. Does anyone else have this problem?
> 

Ughh, they should. I added the ability to specify an alignment via anchor but
instead of centering the buttons by default I mistakenly placed them high and
inside (to a right handed batter). I'll upload a fix today. Thanks for pointing
it out.

[to see, try:
w <- gwindow("test of centered")
g <- ggroup(horizontal=FALSE, cont=w)
b1 <- gbutton("centered? Oops!", cont=g, expand=TRUE)
b2 <- gbutton("centered? Should be", cont=g, anchor= c(0,0), expand=TRUE)

]

--John

> Michael
> 
> >
> > Antje
> >
> >
> >
> >> Tamas
> >>
> >>
> >>
> >> On Wed, 2008-08-06 at 08:19 +0200, Antje wrote:
> >>
> >>> Hello everybody,
> >>>
> >>> is there any nice tutorial how to use gwidgets? Of course, I've found how
> >>> to create simple elements like buttons, but I could not figure out for
> >>> example how to create a window with a special size and a gtree on the left
> >>> side (taking the whole height of the window) and some other elements on the
> >>> right side...o especially I'm looking for information about layout design
> >>> possibilities... (or limitations)
> >>>
> >>> Antje
> >>>
> >>> _______________________________________________
> >>> R-SIG-GUI mailing list
> >>> R-SIG-GUI <at> stat.math.ethz.ch
> >>> https://stat.ethz.ch/mailman/listinfo/r-sig-gui
> >>>
> >>>
> >>
> >>
> > _______________________________________________
> > R-SIG-GUI mailing list
> > R-SIG-GUI <at> stat.math.ethz.ch
> > https://stat.ethz.ch/mailman/listinfo/r-sig-gui
> >
> 
> 	[[alternative HTML version deleted]]
>



More information about the R-SIG-GUI mailing list