directory/file dialog#
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:
Copyright 2015-2022 Matthias Cuntz, see AUTHORS.rst for details.
- license:
MIT License, see LICENSE for details.
The following functions are provided
|
Opens dialog to one select directory |
|
Open dialog to select several directories |
|
Wrapper for |
|
Open dialog to select one or several files |
- History
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
Port to pyjams, Jan 2022, Matthias Cuntz
- 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 direcs: direcs = directories_from_gui() if not direcs: raise ValueError('Error: no directories given.')
- directory_from_gui(initialdir='.', title='Choose directory')[source]#
Opens dialog to one 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 fileExamples
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 file(s)
- Return type:
Notes
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.')