one of my programs that use tkFileDialog.as kopenfilename() , I got an
error because it returns a tuple instead of a null string when I
select Cancel.
Python 2.2:
Python 2.2.2 (#3, Jan 21 2003, 08:39:06)
[GCC 2.95.3 20010315 (release)] on linux2
Type "help", "copyright" , "credits" or "license" for more information.
import tkFileDialog
f=tkFileDialog. askopenfilename ()
print f f '' type(f) <type 'str'>
Python 2.3:
Python 2.3 (#1, Aug 4 2003, 10:43:11)
[GCC 3.2 20020903 (Red Hat Linux 8.0 3.2-7)] on linux2
Type "help", "copyright" , "credits" or "license" for more information. import tkFileDialog
f=tkFileDialog. askopenfilename ()
f () type(f)
<type 'tuple'>
Both versions return a string when I select an actual file. Sometimes
I want to click 'Cancel' when I want to bring up my GUI anyway and
select the file later.
I got around this by just putting in an
if not filename: filename='.'
after my call to askopenfilename ().
Is this a bug or a feature?
Thanks.