File dialog functionsThe file_dialogs module exports a collection of functions for allowing the user to specify new and existing file names.
- request_old_filename(suffixes = None, directory = None)
- Presents a dialog for choosing an existing file. The suffixes is a list of filename extensions defining the files that can be chosen; if not specified, any file can be chosen. The directory
specifies the directory in which to start browsing; if unspecified, the
current working directory is used. Returns the full pathname of the
file chosen, or None if the dialog is cancelled.
- request_new_filename(prompt = None, suffix = None, extra_suffixes = None, directory = None, filename = None, pathname = None)
- Presents a dialog for specifying a new file. The prompt is displayed as a prompt to the user. The suffix,
if any, will be appended to the filename returned if necessary, and
also specifies which files can be chosen. The extra_suffixes can be a
list of additional suffixes of choosable files. The directory and filename specify the starting directory and initial contents of the filename box, or alternatively the pathname can be used to specify both of these together. Returns the full pathname of the file chosen, or None if the dialog is cancelled.
- look_for_file_or_directory(target, directory = None)
- This function is used to ask the user to locate a file or directory with a specific name, specified by the target. Any directory can be visited, but only files whose last pathname component matches the target are visible and choosable. The directory specifies the directory in which to start browsing. Returns the full pathname of the file or directory chosen, or None if the dialog is cancelled.