On Fri, 21 May 2010 08:02:30 +1000, John McMonagle <jmcmona...@no.spam.velseis.com.au> wrote:
>s...@home.com wrote: > >> I have made the modifications and it does print inside the listbox, >> however they are all printed on the same line. >> > >Sorry, I didn't realize askopenfilenames returned the filenames as a >whitespace separated string, on my system they are returned as a tuple >of strings. > > >> My files are named Name.0 Name.1 Name.2 Name.3 etc so I would like >> them to be printed sorted on a separate line. When I did a >> type(fileNames) it showed me that it was in unicode and printed >> character per line, so I tried it this way >> >> listFileNames = str(fileNames).split(' ') >> for fileName in listFileNames: >> self.lbox.insert(0, fileName) >> >> it works but does not print sorted. >> >> it prints >> >> name.2 >> name.1 >> name.0 >> name.3 >> >> > >You obviously need to sort the list before you loop over the items and >add them to your listbox. > >listFileNames = sorted(str(filenames).split() > > >Regards, > >John Thank you, it worked -- http://mail.python.org/mailman/listinfo/python-list