Re: [Rd] Getting width of Tk text widget via tcltk

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Tue 01 Mar 2005 - 03:26:40 EST

"John Fox" <jfox@mcmaster.ca> writes:

> Dear Peter,
>
> (as.numeric(tkwinfo("width", .output$ID))
> - 2*as.numeric(tkcget(.output, borderwidth=NULL)) - 2)/
> as.numeric(tkfont.measure(tkcget(.output, font=NULL), "0"))
>
> (for the text widget .output) appears to do the trick (note, subtracting 2
> rather than 4).

Hmm, that's odd. I needed the 4. Beware that Tcl does integer division (%/%). Did you round() or floor() the result?

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907

______________________________________________
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Tue Mar 01 03:52:55 2005

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 09:03:00 EST