fgui¶
fgui : GUI dialogs to choose files and directories using Tkinter.
This module was written by Matthias Cuntz while at Department of Computational Hydrosystems, Helmholtz Centre for Environmental Research - UFZ, Leipzig, Germany, and continued while at Institut National de Recherche pour l’Agriculture, l’Alimentation et l’Environnement (INRAE), Nancy, France.
Copyright (c) 2015-2020 Matthias Cuntz - mc (at) macu (dot) de Released under the MIT License; see LICENSE file for details.
Written Jun 2014 by Matthias Cuntz (mc (at) macu (dot) de)
Added directories_from_gui, Oct 2015, Matthias Cuntz
Using numpy docstring format, May 2020, Matthias Cuntz
The following functions are provided
|
Opens dialog to select directory. |
|
Open dialog to select several directories. |
|
Wrapper for |
|
Open dialog to select one or several files. |
- directories_from_gui(initialdir='.', title='Choose one or several directories.')[source]¶
Open dialog to select several directories.
- Parameters
- Returns
Selected directories.
- Return type
Examples
if not dirs: dirs = directories_from_gui() if not dirs: raise ValueError('Error: no directories given.')
- directory_from_gui(initialdir='.', title='Choose directory.')[source]¶
Opens dialog to select directory.
- Parameters
- Returns
Selected directory.
- Return type
Examples
if not idir: idir = directory_from_gui() if not idir: raise ValueError('Error: no directory given.')
- file_from_gui(initialdir='.', title='Choose file', multiple=False)[source]¶
Wrapper for
files_from_gui()
with multiple=False, i.e. open dialog to select one file.Examples
if not file: file = file_from_gui() if not file: raise ValueError('Error: no input file given.')
- files_from_gui(initialdir='.', title='Choose file(s).', multiple=True)[source]¶
Open dialog to select one or several files.
- Parameters
- Returns
Selected files.
- Return type
Note
It always returns a list even with multiple=False.
Examples
if not files: files = files_from_gui() if not files: raise ValueError('Error: no input file(s) given.')