[Rd] Getting width of Tk text widget via tcltk

From: John Fox <jfox_at_mcmaster.ca>
Date: Tue 01 Mar 2005 - 01:05:03 EST

Dear list members,

Is it possible via a suitable tcltk command to get the *current* width, in characters, of a Tk text widget that has been resized with the mouse? In the following code, the reported width of the text widget doesn't change, even though it has been resized. I can, however, get the current width in pixels:

> library(tcltk)
> top <- tktoplevel()
> textWindow <- tktext(top, bg="white", height=20, width=80, wrap="none")
> tkgrid(textWindow, sticky="news")

> tkgrid.rowconfigure(top, 0, weight=1)
> tkgrid.columnconfigure(top, 0, weight=1)
> tkcget(textWindow, width=NULL)

<Tcl> 80
> tkwinfo("width", textWindow$ID)

<Tcl> 486  

> # resize window with mouse
> tkcget(textWindow, width=NULL)

<Tcl> 80
> tkwinfo("width", textWindow$ID)

<Tcl> 743

I could convert pixels to characters, but wonder whether I can get the latter directly.

Any help would be appreciated.


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4

R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue Mar 01 01:09:31 2005

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 09:02:59 EST