Johnny Vestergaard skrev:
I dident really find out why this happens, but figured out a workaround:
def string2list(input_string):
input_string = input_string.lstrip('{')
input_string = input_string.rstrip('}')
output = input_string.split('} {')
return output
import Tkinter
import tkFileDialog
root = Tkinter.Tk()
input_files = tkFileDialog.askopenfilenames(filetypes = [('.TXT files',
'.txt')], title ="Select files", multiple = 1 )
input_files = string2list(input_files)
for file in input_files:
print file
Tkinter.mainloop()
Hi,
I recently upgraded from Python 2.4 to Python 2.6.2 and have had some
unexpected issues with unicode.
I had the following code working properly in 2.4:
---code start---
import Tkinter
import tkFileDialog
root = Tkinter.Tk()
input_files = tkFileDialog.askopenfilenames(filetypes = [('.TXT
files', '.txt')], title ="Select files", multiple = 1 )
print type(input_files)
for file in input_files:
print file
Tkinter.mainloop()
---code end---
In 2.4 it returned a tuple containing the selected filenames, but in
2.6.2 it seems to return a unicode string (which i cant really use for
anything). It is the same computerm using (windows XP), only
difference is the version of Python.
Any hints to what might be going on?
The output from 2.6.2:
<type 'unicode'>
{
C
:
/
D
o
c
u
m
e
n
t
s
a
n
d
s
e
t
t
i
n
g
s
..... and continues that way
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss