askopenfilename

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
CAB
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

askopenfilename

CAB
I am observing some strange behavior in askopenfilename. I am working under Python 2.7 on a Windows7 system. Let's say I have the following bit of code:


f = askopenfilename(parent=root, filetypes=[('Text', '.txt'), ('Documents', '.doc'), ('All Files', '*.*')])


When the Open File dialog opens, it has a pulldown list of the filetypes. That's great. However, in my hands, the filetype that is chosen by default by tkinter in that list changes from call to call. That is, on some occasions, the default selection in that dropdown is "Text (*.txt)". Other times, from the same bit of code, the default selction is "All Files (*.*)". It always seems to default to either the first item in the list or the last item.

I wish I could post the code in which I observe this behavior, but it is quite complex and long. I can't recapitulate the behavior in a little jiffy that I wrote to test this. In that jiffy, the default item selected in the pulldown filetype list is *always* the first item in the list.

And so, I guess my question is, what would cause askopenfilename to default this pulldown list to the last item? Is there any way to tell it which item in the list to select as the default?  I can't find anything in the docs that helps.

Thanks,
Chad

_______________________________________________
Tkinter-discuss mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/tkinter-discuss
Loading...