frame.pack(side='top')
measure = Label(frame, font=('Purisa', 10), text=
    'The width of this in pixels is.....', bg='yellow')
measure.grid(row=0, column=0)
measure.update_idletasks()
width = measure.winfo_width()
canvas = Canvas(frame, width=400, height=200, bg='light green')
canvas.grid(row=1, column=0, columnspan=100)
line = canvas.create_line(0, 10, width, 10, width=4)
canvas.create_text(10, 20, font=('Purisa', 10), text='... ' + str(width) +
    ' Pixels', anchor='nw')
Calculating the pixel size of a string with Python