tkFileDialog.askopenfilename

Martin Franklin mfranklin1 at gatwick.westerngeco.slb.com
Thu Mar 4 21:12:44 CET 2004


Sonia Rovner wrote:
> tkFileDialog.askopenfilename only allows you to open an existing file.
>  I want to allow my users to enter a new filename in the dialog box. 
> Can anyone help?

tkFileDialog.saveasfilename could be what you are looking for...

trusty pydoc comes to the rescue...

$ pydoc tkFileDialog

<snip>

FUNCTIONS
     askdirectory(**options)
         Ask for a directory, and return the file name
 

     askopenfile(mode='r', **options)
         Ask for a filename to open, and returned the opened file
 

     askopenfilename(**options)
         Ask for a filename to open
 

     askopenfilenames(**options)
         Ask for multiple filenames to open
 

         Returns a list of filenames or empty list if
         cancel button selected
 

     askopenfiles(mode='r', **options)
         Ask for multiple filenames and return the open file
         objects
 

         returns a list of open file objects or an empty list if
         cancel selected
 

     asksaveasfile(mode='w', **options)
         Ask for a filename to save as, and returned the opened file

     asksaveasfilename(**options)
         Ask for a filename to save as


HTH
Martin




More information about the Python-list mailing list