File: file_dialog.py

package info (click to toggle)
magicgui 0.10.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 21,880 kB
  • sloc: python: 11,573; makefile: 11; sh: 9
file content (19 lines) | stat: -rw-r--r-- 376 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""# File dialog widget

A dialog to select a file.
"""

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)