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

2005-02-28 Thread Peter Dalgaard
"John Fox" <[EMAIL PROTECTED]> writes: > Dear Peter, > > As you can see from the expression, I didn't use integer division, nor did I > round() or floor(). Here's my original example, using a monospaced font: > > > library(tcltk) > > top <- tktoplevel() > > textWindow <- tktext(top, bg="white",

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

2005-02-28 Thread John Fox
905-525-9140x23604 http://socserv.mcmaster.ca/jfox > -Original Message- > From: Peter Dalgaard [mailto:[EMAIL PROTECTED] > Sent: Monday, February 28, 2005 11:27 AM > To: John Fox > Cc: 'Peter Dalgaard'; r-devel@stat.math.ethz.ch &

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

2005-02-28 Thread Peter Dalgaard
"John Fox" <[EMAIL PROTECTED]> 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, subt

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

2005-02-28 Thread John Fox
PROTECTED] On Behalf Of Peter Dalgaard > Sent: Monday, February 28, 2005 10:39 AM > To: Prof Brian Ripley > Cc: John Fox; r-devel@stat.math.ethz.ch > Subject: Re: [Rd] Getting width of Tk text widget via tcltk > > Prof Brian Ripley <[EMAIL PROTECTED]> writes: > >

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

2005-02-28 Thread Peter Dalgaard
Prof Brian Ripley <[EMAIL PROTECTED]> writes: > > 743 > > > > I could convert pixels to characters, but wonder whether I can get the > > latter directly. > > I suspect you may have some difficulty with the latter, even in a > monospace font. Notice that 486 is not a multiple of 80, and if that

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

2005-02-28 Thread John Fox
Brian Ripley [mailto:[EMAIL PROTECTED] > Sent: Monday, February 28, 2005 9:25 AM > To: John Fox > Cc: r-devel@stat.math.ethz.ch > Subject: Re: [Rd] Getting width of Tk text widget via tcltk > > On Mon, 28 Feb 2005, John Fox wrote: > > > Dear list members, > > >

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

2005-02-28 Thread Prof Brian Ripley
On Mon, 28 Feb 2005, John Fox wrote: 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 be

[Rd] Getting width of Tk text widget via tcltk

2005-02-28 Thread John Fox
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