Using python 2.7 and Tkinter
I have a Listbox widget and a Text widget showing the same text.
In the Text widget everything looks correct. But in the Listbox the font is different and where there are ' chars the text gets to be jumbled.
How can the Listbox text be shown properly ?
Here's a screenshot of the Text widget:

And Here's one for the Listbox widget:

The listbox creation code is:
self.r_list = Listbox(self.frame, selectmode='multiple', exportselection=0)
for item in self.all:
self.r_list.insert(END, item)
and the text creation code is:
self.r_text = Text(self.frame)
self.r_text.insert(END, "\n".join(self.all))
self.r_text.config(state=DISABLED)
Where the self.all var is:
[u'\u05d0\u05dc\u05d5\u05e8\u05d4', u"\u05e6'\u05d5\u05e4 \u05e6'\u05d5\u05e4"]
Solved by setting font in the listbox
self.r_list = Listbox(self.frame, selectmode='multiple', exportselection=0, font=('Tahoma', 8))
It's not just the Tahoma font that works, I guess it's mostly an issue of the default font.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With