You wanted to ask: "How to measure the width of a string rendering through tkFont without first creating a window?"
Answer: you cannot. Tk needs a root instance for drawing, etc.
you can create it, measure your text and immediately delete it with .delete() . It is so fast that the window does not appear to me.
source share