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.FD_OPEN | This is an open dialog.
> wx.FD_SAVE | This is a save dialog.
> wx.FD_OVERWRITE_PROMPT | For save dialog only: prompt for a confirmation if a file will be overwritten.
> wx.FD_MULTIPLE | For open dialog only: allows selecting multiple files.
> wx.FD_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.
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.
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).
| ``SetWildcard`(self, wildCard)` Sets the wildcard, which can contain multiple file types, for example:

Property Summary
| `Directory`: See `GetDirectory` and `SetDirectory`
| `Filename`: See `GetFilename` and `SetFilename`
| `Filenames`: See `GetFilenames`
| `FilterIndex`: See `GetFilterIndex` and `SetFilterIndex`
| `Message`: See `GetMessage` and `SetMessage`
| `Path`: See `GetPath` and `SetPath`
| `Paths`: See `GetPaths`
| `thisown`: The membership flag
| `Wildcard`: See `GetWildcard` and `SetWildcard`

Class Variable Summary

Instance Method Details

### __init__(self, parent, message=FileSelectorPromptStr, defaultDir=EmptyString, defaultFile=EmptyString, wildcard=FileSelectorDefaultWildcardStr, style=FD_DEFAULT_STYLE, 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

### 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)

### 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)

Property Details

### Directory

See `GetDirectory` and `SetDirectory`

  Get Method:
    `GetDirectory`(self)
  Set Method:
    `SetDirectory`(self, dir)

### Filename

See `GetFilename` and `SetFilename`

  Get Method:
    `GetFilename`(self)
  Set Method:
    `SetFilename`(self, name)

### Filenames

See `GetFilenames`

  Get Method:
    `GetFilenames`(self)

### FilterIndex

See `GetFilterIndex` and `SetFilterIndex`

  Get Method:
    `GetFilterIndex`(self)
  Set Method:
    `SetFilterIndex`(self, filterIndex)

### Message

See `GetMessage` and `SetMessage`

  Get Method:
    `GetMessage`(self)
  Set Method:
    `SetMessage`(self, message)

### Path

See `GetPath` and `SetPath`

  Get Method:
    `GetPath`(self)
  Set Method:
    `SetPath`(self, path)

### Paths

See `GetPaths`

  Get Method:
    `GetPaths`(self)

### thisown

The membership flag

### Wildcard

See `GetWildcard` and `SetWildcard`

  Get Method:
    `GetWildcard`(self)
  Set Method:
    `SetWildcard`(self, wildCard)

Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:09:31 2007 | http://epydoc.sf.net