The Text object holding a string (in a specified font) seems to give inconsistent results depending on the length of the string. For example:
from Tkinter import *
import tkFont
root=Tk()
t_Font = tkFont.Font(family='Helvetica', size=12, weight='bold')
t_text='New.'
t_frame = Frame(root, bd=0, height=10, width=t_Font.measure(t_text))
t = Text(master=t_frame, height=1, width=len(t_text), bd=1, font=t_Font, padx=0)
print '\n\nMeasured:', t_Font.measure(t_text), 'Frame req:', \
t_frame.winfo_reqwidth(), 'As Text:', t.winfo_reqwidth()
Measured: 38 Frame req: 38 As Text: 38
t_text='New title.'
t_frame = Frame(root, bd=0, height=10, width=t_Font.measure(t_text))
t = Text(master=t_frame, height=1, width=len(t_text), bd=1, font=t_Font, padx=0)
print '\n\nMeasured:', t_Font.measure(t_text), 'Frame req:', \
t_frame.winfo_reqwidth(), 'As Text:', t.winfo_reqwidth()
Measured: 69 Frame req: 69 As Text: 92
The additional 6 characters increased the measured size and frame size by 31 pixels, but the Text object has increased by 54.
What causes this?