Annoying Text Wrap
So I was trying to learn some Tkinter GUI. Had a couple controls on the screen. Needed to display some text instructions and feedback to the user. Sounded like a job for a Message object. The only problem was that there was excessive word wrapping going on. I had a single sentence. But it was broken up into 4 lines like this:
That was very annoying. My code seemed simple enough:
output = tkinter.Message(text='Welcome to the game. Choose a door.')
output.place(x=10,y=330,width=500,height=150)
You would think the 500 width would allow the whole sentence to be draw in a single line. Turns out that is not the default behavior of this Message control. It took a while to find the property I needed to modify was the aspect. It controls the width to height ratio. The default wants the text to seem to be as high as it is wide. But that just does not look good. Here is my modification that corrected that:
output = tkinter.Message(text='Welcome to the game. Choose a door.',aspect=1000)
This told Tkinter to make my output 1000 times wider than it is tall. No unnecessary sentence splits now. Here is the updated look of my app:
Now I hope the rest of the Tkinter controls don''t have strange defaults preset. Also hope that the properties are more intuitive to experienced GUI developers.