Mark Heckmann
2011-Dec-22 00:31 UTC
[R] RGtk2: How to overlay a gtkDrawingArea with a button or any other widget?
I try to overlay a plot inside a gtkDrawingArea with a button (or any other widget). I tried to put both into a gtkFixed container. But this does not work, no printing occurs. Does someone know a solution? What I tried: w <- gtkWindow() w$setSizeRequest(400,400) fx <- gtkFixed() da <- gtkDrawingArea() fx$put(da, 100, 100) asCairoDevice(da) par(mar=c(0,0,0,0)) plot(1:10) btn.1 <- gtkButton("button") fx$put(btn.1, 200, 200) w$add(fx) Thanks Mark ???????????????????????????????????? Mark Heckmann Blog: www.markheckmann.de R-Blog: http://ryouready.wordpress.com
Michael Lawrence
2012-Jan-16 15:04 UTC
[R] RGtk2: How to overlay a gtkDrawingArea with a button or any other widget?
Sorry for the late reply to this one. You'll need to make sure that the drawing area is realized prior to plotting, i.e., it should be in a visible container. Also, since you are using GtkFixed, you will need to set an explicit size request on the drawing area (otherwise it has zero area). Michael On Wed, Dec 21, 2011 at 4:31 PM, Mark Heckmann <mark.heckmann@gmx.de> wrote:> I try to overlay a plot inside a gtkDrawingArea with a button (or any > other widget). > I tried to put both into a gtkFixed container. > But this does not work, no printing occurs. > Does someone know a solution? > > What I tried: > > w <- gtkWindow() > w$setSizeRequest(400,400) > fx <- gtkFixed() > da <- gtkDrawingArea() > fx$put(da, 100, 100) > asCairoDevice(da) > par(mar=c(0,0,0,0)) > plot(1:10) > btn.1 <- gtkButton("button") > fx$put(btn.1, 200, 200) > w$add(fx) > > Thanks > Mark > > –––––––––––––––––––––––––––––––––––– > Mark Heckmann > Blog: www.markheckmann.de > R-Blog: http://ryouready.wordpress.com > > ______________________________________________ > R-help@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. >[[alternative HTML version deleted]]