pylab_ml.common.file_io.filedialog

filedialog(initialdir, title, filetypes)[source]

Open a file dialog to select a file.

eg. filedialog(initialdir=’/path/to/directory’, title=’Select a file’, filetypes=[(‘Text files’, ‘.txt’), (‘All files’, ‘.*’)]) will open a file dialog with the specified initial directory, title, and file types to filter the displayed files. The user can select a file, and the function will return the path to the selected file as a string.

Parameters:
  • initialdir (str) – The initial directory to open in the file dialog.

  • title (str) – The title of the file dialog.

  • filetypes (list of tuples) – The file types to display in the file dialog.

Returns:

filename : The selected file path.

Return type:

str