Note
Click here to download the full example code
File dialog widget#
A dialog to select a file.
Out:
<FunctionGui filepicker(filename=PosixPath('~')) -> pathlib._local.Path>
from pathlib import Path
from magicgui import magicgui
@magicgui(filename={"mode": "r"})
def filepicker(filename=Path("~")) -> Path:
"""Take a filename and do something with it."""
print("The filename is:", filename)
return filename
filepicker.filename.changed.connect(print)
filepicker.show(run=True)
Total running time of the script: ( 0 minutes 0.036 seconds)
Download Python source code: file_dialog.py