September 6th, 2005, 04:32 PM
Tkinter Message Widget and strange line wrapping
So there's the code to display the results of a program in a message widget. I wanted the message widget's capability to automatically wrap lines and such so it seem like a good match until I ran the software. On my system (Windows XPSP2, Python 2.4) the widget seems to wrap the text in the widget about halfway across no matter what I do.
msg_roll_results = Message(self, textvariable=self.roll_results, relief=RIDGE, anchor=NW, font=self.results_font, aspect=200, bg="#FFFFFF")
The displayed results are a list of numbers seperated by commas (i.e. 1, 1, 2, 4, 5, 6, 6) and it is for a dice roller for a game. You can download a windows installer from the link below to see it in action and the source code is listed as well in case someone needs that (both for non-windows testing and otherwise)
September 7th, 2005, 12:22 AM
I've now altered the code (not updated yet at the links above) but get the same results. The alteration is as follows: I've build a display string that is the same as the printing the list of die rolls except that it does not include the [ and ] at the beginning and end of the print out. Users were complaining that the brackets looked like ones and, thus, I removed them hoping to (a) end the confusion and (b) use up all of the Message widget's space.
However, it didn't work. Well, the confusion was ended (which is good) but the widget still isn't full. Just wanted to let you all know in case it helped.