Package wx :: Class FileDialog
[frames | no frames]

Type FileDialog

object --+                    
         |                    
    Object --+                
             |                
    EvtHandler --+            
                 |            
            Window --+        
                     |        
        TopLevelWindow --+    
                         |    
                    Dialog --+
                             |
                            FileDialog


wx.FileDialog allows the user to select one or more files from the filesystem.

In Windows, this is the common file selector dialog. On X based platforms a generic alternative is used. The path and filename are distinct elements of a full file pathname. If path is "", the current directory will be used. If filename is "", no default filename will be supplied. The wildcard determines what files are displayed in the file selector, and file extension supplies a type extension for the required filename.

Both the X and Windows versions implement a wildcard filter. Typing a filename containing wildcards (*, ?) in the filename text item, and clicking on Ok, will result in only those files matching the pattern being displayed. The wildcard may be a specification for multiple types of file with a description for each, such as:

"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"

Window Styles

wx.OPEN This is an open dialog.
wx.SAVE This is a save dialog.
wx.HIDE_READONLY For open dialog only: hide the checkbox allowing to open the file in read-only mode.
wx.OVERWRITE_PROMPT For save dialog only: prompt for a confirmation if a file will be overwritten.
wx.MULTIPLE For open dialog only: allows selecting multiple files.
wx.CHANGE_DIR Change the current working directory to the directory where the file(s) chosen by the user are.

Method Summary
FileDialog __init__(self, parent, message, defaultDir, defaultFile, wildcard, style, pos)
Constructor.
  __repr__(self)
String GetDirectory(self)
Returns the default directory.
String GetFilename(self)
Returns the default filename.
PyObject GetFilenames(self)
Returns a list of filenames chosen in the dialog.
int GetFilterIndex(self)
Returns the index into the list of filters supplied, optionally, in the wildcard parameter.
String GetMessage(self)
Returns the message that will be displayed on the dialog.
String GetPath(self)
Returns the full path (directory and filename) of the selected file.
PyObject GetPaths(self)
Fills the array paths with the full paths of the files chosen.
long GetStyle(self)
Returns the dialog style.
String GetWildcard(self)
Returns the file dialog wildcard.
  SetDirectory(self, dir)
Sets the default directory.
  SetFilename(self, name)
Sets the default filename.
  SetFilterIndex(self, filterIndex)
Sets the default filter index, starting from zero.
  SetMessage(self, message)
Sets the message that will be displayed on the dialog.
  SetPath(self, path)
Sets the path (the combined directory and filename that will be returned when the dialog is dismissed).
  SetStyle(self, style)
Sets the dialog style.
  SetWildcard(self, wildCard)
Sets the wildcard, which can contain multiple file types, for example:

Instance Method Details

__init__(self, parent, message=FileSelectorPromptStr, defaultDir=EmptyString, defaultFile=EmptyString, wildcard=FileSelectorDefaultWildcardStr, style=0, pos=DefaultPosition)
(Constructor)

Constructor. Use ShowModal method to show the dialog.
Parameters:
parent
           (type=Window)
message
           (type=String)
defaultDir
           (type=String)
defaultFile
           (type=String)
wildcard
           (type=String)
style
           (type=long)
pos
           (type=Point)
Returns:
FileDialog
Overrides:
wx.Dialog.__init__

GetDirectory(self)

Returns the default directory.
Returns:
String

GetFilename(self)

Returns the default filename.
Returns:
String

GetFilenames(self)

Returns a list of filenames chosen in the dialog. This function should only be used with the dialogs which have wx.MULTIPLE style, use GetFilename for the others.
Returns:
PyObject

GetFilterIndex(self)

Returns the index into the list of filters supplied, optionally, in the wildcard parameter. Before the dialog is shown, this is the index which will be used when the dialog is first displayed. After the dialog is shown, this is the index selected by the user.
Returns:
int

GetMessage(self)

Returns the message that will be displayed on the dialog.
Returns:
String

GetPath(self)

Returns the full path (directory and filename) of the selected file.
Returns:
String

GetPaths(self)

Fills the array paths with the full paths of the files chosen. This function should only be used with the dialogs which have wx.MULTIPLE style, use GetPath for the others.
Returns:
PyObject

GetStyle(self)

Returns the dialog style.
Returns:
long

GetWildcard(self)

Returns the file dialog wildcard.
Returns:
String

SetDirectory(self, dir)

Sets the default directory.
Parameters:
dir
           (type=String)

SetFilename(self, name)

Sets the default filename.
Parameters:
name
           (type=String)

SetFilterIndex(self, filterIndex)

Sets the default filter index, starting from zero.
Parameters:
filterIndex
           (type=int)

SetMessage(self, message)

Sets the message that will be displayed on the dialog.
Parameters:
message
           (type=String)

SetPath(self, path)

Sets the path (the combined directory and filename that will be returned when the dialog is dismissed).
Parameters:
path
           (type=String)

SetStyle(self, style)

Sets the dialog style.
Parameters:
style
           (type=long)

SetWildcard(self, wildCard)

Sets the wildcard, which can contain multiple file types, for example:

"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"
Parameters:
wildCard
           (type=String)

Generated by Epydoc 2.1.20040428.rpd on Tue Apr 26 14:23:17 2005 http://epydoc.sf.net