A Python\Tkinter Listbox Question

Jeff Dunnett jdunnett at uoguelph.ca
Sun Oct 28 19:38:15 EST 2001


I am having trouble keeping spacing when trying to enter things into a
list box.  I was wondering if there is anyone to maintain spacing when
you enter strings an item into the listbox.  For example the below code
fragement is mean to read something in from a file pionter which has
some output from a C program.  It then strips the the whitespace, and
newline character at the end and expands the tabs.  I want to maintain
that tab spacing when I get enter the string into the listobx is this
possible?


for item in input.readlines():
      newitem = string.strip(item)
      newitem = item[:-1]
      newitem = string.expandtabs(newitem)
      print newitem
      self.object.toc.listbox.insert(END, newitem)

Jeff






More information about the Python-list mailing list