tkinter text width
James Stroud
jstroud at mbi.ucla.edu
Wed Apr 27 15:52:21 EDT 2005
Thank you to everybody helping me. I think I am almost there...
On Wednesday 27 April 2005 12:10 pm, so sayeth Jeremy Bowers:
> 2. Use a fixed-width font and manually wrap. (It's pretty easy then, you
> can ask the font for how wide any char is and do the math from there.)
How might I query the size of a fixed-width font in pixles? It appears that
the width of the font in points does not correlate with its width in pixels
based on some simple expriments I have done. Using cget("font") on the Text
gives back a string with the point size.
> [snip some things to worry about]
> Basically, I'm pretty sure you can't do this.
My setup is not very complicated, so I don't think I have to worry about
kerning, unicode, etc.. I am using a fixed width font (courier) only, and
only one size and am also quite comfortable with giving away several pixels
at the end of a line for "rounding errors" and will filter for a limited
alphabet consisting only of the numbers, the captial letters, and the space.
I think I can do this given these limitations.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
More information about the Python-list
mailing list