[R-gui] After resizing a tkwidget, how do I get the size of the widget??

James Wettenhall wettenhall at wehi.EDU.AU
Thu Sep 29 04:06:09 CEST 2005


Hi Søren,

> Dear all,
> I am trying make a small tcltk thing for drawing graphs with vertices,
> edges etc. I can draw the graph in a window.
> - I would like it so that if I resize the window, the graph will also be
> resized.

Are you using tkrplot?  If so, I have tried implementing ways to allow
dragging the corner of a tk window with a plot in it and have it
automatically resize, but I have found it to be quite difficult.  So my
two solutions are either 1. Just use the regular R graphics device (not
tkrplot), or 2. Have a pull-down (or pop-up) menu from your tkrplot window
which allows the user to enter horizontal and vertical scaling factors for
the plot (in a dialog box) so they can resize it, even if it's not by
dragging the corner of the plot window.  Or even have the entry boxes for
horizontal and vertical scaling factors on the same tk window as the plot
(beside the plot or above it or whatever), so that the user can instantly
see how to resize the plot, e.g. by replacing a horizontal scaling factor
of 1.5 by 1.6.  A bit ugly?  Yes.  But I've never found a really nice
solution to this problem.

If you are using Windows, then in my opinion, using the regular R graphics
device in an R-Tcl/Tk application is quite ugly if you are running R in
MDI (Multiple Document Interface) mode.  BUT it looks fine if you are
running R in SDI (Single Document Interface) mode.

Hope this helps,
James



More information about the R-SIG-GUI mailing list