From Dabo Wiki
Revision as of 20:37, 13 May 2020 by Ed (talk | contribs) (Created page with "== Signature: == <syntaxhighlight lang="python"> dabo.ui.getFileAndType(*args, **kwargs) </syntaxhighlight> Additionally, you can pass Keyword args: '''message=''' Text stri...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


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.


Displays the file selection dialog for the platform.


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


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").


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.