File: files_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 (23 lines) | stat: -rw-r--r-- 601 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""# File dialog widget

A dialog to select multiple files.
"""

from collections.abc import Sequence
from pathlib import Path

from magicgui import magicgui


# Sequence of paths
# We change the label using "label" for added clarity
# the filter argument restricts file types
@magicgui(filenames={"label": "Choose Tiff files:", "filter": "*.tif"})
def filespicker(filenames: Sequence[Path]) -> Sequence[Path]:
    """Take a filename and do something with it."""
    print("The filenames are:", filenames)
    return filenames


filespicker.filenames.changed.connect(print)
filespicker.show(run=True)