Dabo.ui.getFileAndType

From Dabo Wiki
Jump to: navigation, search

Signature:

dabo.ui.getFileAndType(*args, **kwargs)

Additionally, you can pass Keyword args: message= Text string to use as the prompt (title of the dialog window). defaultPath= Directory to use as the starting place for file dialog. multiple=True Allows the selection of multiple files.

Description:

Displays the file selection dialog for the platform.

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.getFile() for a more complete description of this function. The only difference between getFileAndType() and getFile() 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.getFileAndType("py", "txt"), and the user chose the Text file option in the file dialog, the function will return (<file path>, "txt").

Examples:

dabo.ui.getFile("*", defaultPath=".")  # Displays all files in current directory.
dabo.ui.getFile("py", "*")  # Displays either just Python scripts, or all files.
dabo.ui.getFile("png", "jpg", "gif")  #Allows the user to select from any of these three graphic formats.