Dabo.ui.getSaveAsAndType

From Dabo Wiki
Jump to: navigation, search

Signature:

dabo.ui.getFolder(message="Choose a folder", defaultPath="", wildcard="*")

Description:

Presents the user with the operating system dialog that allows them to specify a file name and a specific location. Commonly used for specifying where a user would like to save a file.

Returns:

Returns a 2-tuple, with the first element being the path to the selected file, and the second being the type of file chosen by the user. If no selection was made, returns (None, None).

Comments:

See dabo.ui.getSaveAs() for a more complete description of this function, and dabo.ui.getFile() for information on specifying file types in the parameters. The only difference between getSaveAsAndType() and getSaveAs() is that this function returns the file type selected by the user in addition to the path. So if this function was called as dabo.ui.getSaveAsAndType("py", "txt"), and the user chose the Text file option in the file dialog, the function will return (<file path>, "txt"). This is especially useful because it enables the user to simply type the desired name of the file, and you can then add the extension based on the chosen file type.