tkinter: font measure()

Matthew Dixon Cowles matt at mondoinfo.com
Wed Jul 19 20:38:15 EDT 2000


In article <3975E3D5.36CB58D4 at uniserve.com>, Bob van der Poel
<bvdpoel at uniserve.com> wrote:

> Anyone know how to use the font measure() thing in tkinter?

I had to figure this out just the other day. Here's what works for me:

>>> import Tkinter
>>> foo=Tkinter.Toplevel()
>>> import tkFont
>>> f=tkFont.Font(family="7x13")
>>> f.measure("wibble")
42

The Toplevel() call wouldn't be necessary in your program since you'd
have already called mainloop().

Best regards,
Matt



More information about the Python-list mailing list