def _split_tkstring(text): while text: part, sep, text = text.partition(u' ') if part.startswith(u'{'): if part.endswith(u'}'): yield part.lstrip(u'{').rstrip(u'}') else: rest, sep, text = text.partition(u'}') yield part.lstrip(u'{') + u' ' + rest text = text[1:] #space else: yield part def askopenfilenames(*args, **kwds): result = tkFileDialog.askopenfilenames(*args, **kwds) #BUG in python http://bugs.python.org/issue5712 if isinstance(result, unicode): result = tuple(_split_tkstring(result)) return result