GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing docs.wxpython.org — wx.FileDialog — wxPython 4.3.2 Docs
|
Constructor. |
|
Add a directory to the list of shortcuts shown in the dialog. |
|
Returns the path of the file currently selected in dialog. |
|
Returns the file type filter index currently selected in dialog. |
|
Returns the default directory. |
|
If functions |
|
Returns the default filename. |
|
Returns a list of filenames chosen in the dialog. This function |
|
Returns the index into the list of filters supplied, optionally, in the wildcard parameter. |
|
Returns the message that will be displayed on the dialog. |
|
Returns the full path (directory and filename) of the selected file. |
|
Returns a list of the full paths of the files chosen. This function |
|
Returns the file dialog wildcard. |
|
Set the hook to be used for customizing the dialog contents. |
|
Sets the default directory. |
|
Sets the default filename. |
|
Sets the default filter index, starting from zero. |
|
Sets the message that will be displayed on the dialog. |
|
Sets the path (the combined directory and filename that will be returned when the dialog is dismissed). |
|
Sets the wildcard, which can contain multiple file types, for example: “ |
|
Shows the dialog, returning |
Properties Summary¶See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
Class API¶Possible constructors:
FileDialog(parent, message=FileSelectorPromptStr, defaultDir='', defaultFile='', wildcard=FileSelectorDefaultWildcardStr, style=FD_DEFAULT_STYLE, pos=DefaultPosition, size=DefaultSize, name=FileDialogNameStr) -> None
This class represents the file chooser dialog.
Constructor.
Use ShowModal to show the dialog.
parent (wx.Window) – Parent window.
message (string) – Message to show on the dialog.
defaultDir (string) – The default directory, or the empty string.
defaultFile (string) – The default filename, or the empty string.
wildcard (string) – A wildcard, such as “x.x” or “BMP files (.bmp)|.bmp|GIF files (.gif)|.gif”.
style (long) – A dialog style. See FD_* styles for more info.
pos (wx.Point) – Dialog position. Not implemented.
size (wx.Size) – Dialog size. Not implemented.
name (string) – Dialog name. Not implemented.
None
Add a directory to the list of shortcuts shown in the dialog.
File dialogs on many platforms display a fixed list of directories which can be easily selected by the user. This function allows to add an application-defined directory to this list, which can be convenient for the programs that use specific directories for their files instead of the default user document directory (see wx.StandardPaths).
Currently this function is only implemented in wxMSW and wxGTK and does nothing under the other platforms. Moreover, in wxMSW this function is incompatible with the use of SetExtraControlCreator , if you need to use this function and customize the dialog contents, please use the newer SetCustomizeHook instead.
The dialogs sample shows the use of this function by adding two custom shortcuts corresponding to the subdirectories of WXWIN environment variable if it is defined.
directory (string) – The full path to the directory, which should exist.
flags (int) – Can be set to FD_SHORTCUT_BOTTOM (which is also the default behaviour) to add the shortcut after the existing ones, or FD_SHORTCUT_TOP to add it before them. Support for the latter flag is only available in wxMSW, in wxGTK the shortcuts are always added to the bottom of the list.
bool
True on success or False if shortcut couldn’t be added, e.g. because this functionality is not available on the current platform.
Added in version 4.3/wxWidgets-3.3.0.
Note
In wxMSW, the shortcuts appear in a separate section called “Application Links” by default. To change the title of this section, the application can specify a value of the FileDescription field of the version information structure in its resource file –
variant (WindowVariant)
Returns the path of the file currently selected in dialog.
Notice that this file is not necessarily going to be accepted by the user, so calling this function mostly makes sense from an update UI event handler of a custom file dialog extra control to update its state depending on the currently selected file.
Currently this function is fully implemented under GTK and MSW and always returns an empty string elsewhere.
str
The path of the currently selected file or an empty string if nothing is selected.
Added in version 2.9.5.
See also
SetExtraControlCreator
Returns the file type filter index currently selected in dialog.
Notice that this file type filter is not necessarily going to be the one finally accepted by the user, so calling this function mostly makes sense from an update UI event handler of a custom file dialog extra control to update its state depending on the currently selected file type filter.
Currently this function is fully implemented under macOS and MSW and always returns NOT_FOUND elsewhere.
int
The 0-based index of the currently selected file type filter or wx.NOT_FOUND if nothing is selected.
Added in version 4.1/wxWidgets-3.1.3: - MSW
Added in version 4.1/wxWidgets-3.1.5: - macOS
See also
SetExtraControlCreator
See also
See also
Returns the default directory.
str
If functions SetExtraControlCreator and ShowModal were called, returns the extra window.
Otherwise returns nullptr.
Added in version 2.9.0.
Returns the default filename.
str
Note
This function can’t be used with dialogs which have the FD_MULTIPLE style, use GetFilenames instead.
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.
List[str]
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.
int
Returns the message that will be displayed on the dialog.
str
Returns the full path (directory and filename) of the selected file.
str
Note
This function can’t be used with dialogs which have the FD_MULTIPLE style, use GetPaths instead.
Returns a list of 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.
List[str]
Returns the file dialog wildcard.
str
Set the hook to be used for customizing the dialog contents.
This function can be called before calling ShowModal to specify that the dialog contents should be customized using the provided hook. See wx.FileDialogCustomizeHook documentation and Dialogs Sample for the examples of using it.
customizeHook (wx.FileDialogCustomizeHook) – The hook object that will be used by the dialog. This object must remain valid at least until ShowModal returns.
bool
True if the hook was successfully set or False if customizing the file dialog is not supported by the current platform.
Added in version 4.1/wxWidgets-3.1.7.
Note
In order to define a custom hook object, /filedlgcustomize.h must be included in addition to the usual /filedlg.h header.
Sets the default directory.
directory (string)
None
Sets the default filename.
In wxGTK this will have little effect unless a default directory has previously been set.
setfilename (string)
None
Sets the default filter index, starting from zero.
filterIndex (int)
None
Sets the message that will be displayed on the dialog.
message (string)
None
Sets the path (the combined directory and filename that will be returned when the dialog is dismissed).
path (string)
None
Sets the wildcard, which can contain multiple file types, for example: “BMP files (.bmp)|.bmp|GIF files (.gif)|.gif”.
wildCard (string)
None
Shows the dialog, returning ID_OK if the user pressed wx.OK, and ID_CANCEL otherwise.
int
See GetDirectory and SetDirectory
See GetExtraControl
See GetFilename and SetFilename
See GetFilenames
See GetFilterIndex and SetFilterIndex
See GetMessage and SetMessage
See GetWildcard and SetWildcard