[Tkinter-discuss] listbox formatting

Jeff Cagle jrcagle at juno.com
Sun Aug 20 07:35:32 CEST 2006


I have strings that are composed of multiple properties within an 
object.  I wanted to format the strings so that they came out nicely in 
a listbox.  However, listbox widgets choke on the '\t' character, so I 
tried to roll my own:

def get_lbstring(self):
  s = self.datestring
  return s + " " * (20 - len(s)) + self.name

unfortunately, listboxes *also* have variable-width fonts (at least as 
the default).  Short of changing to Courier font, is there a way to get 
items to line up in a listbox?

Thanks,
Jeff Cagle




More information about the Tkinter-discuss mailing list