Web Analytics Made Easy - Statcounter
Skip to content

Popup get file

Display popup window with text entry field and browse button so that a file can be chosen by user.

popup_get_file(
    message,
    default_path = "",
    default_extension = "",
    save_as = False,
    file_types = (('ALL Files', '*.*'),),
    no_window = False,
    size = (None, None),
    button_color = None,
    background_color = None,
    text_color = None,
    icon = "default_icon.ico",
    font = None,
    no_titlebar = False,
    grab_anywhere = False,
    keep_on_top = False,
    location = (None, None),
    initial_folder = None
)

Parameter Descriptions

Name Type Default Description
background_color str None background color of the entire window
button_color (str, str) or str None Color of the button (text, background)
default_extension str If no extension entered by user, add this to filename (only used in saveas dialogs)
default_path str path to display to user as starting point (filled into the input field)
file_types Tuple[Tuple[str,str]] (('ALL Files', '.'),) List of extensions to show using wildcards. All files (the default) = (("ALL Files", ". *"),).
font (str or (str, int[, str]) or None) None specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
grab_anywhere bool False If True: can grab anywhere to move the window (Default = False)
icon bytes or str default_icon.ico filename or base64 string to be used for the window's icon
initial_folder str None location in filesystem to begin browsing
keep_on_top bool False If True the window will remain above all current windows
location (int, int) (None, None) Location of upper left corner of the window
message str message displayed to user
no_titlebar bool False If True no titlebar will be shown
no_window bool False if True, no PySimpleGUI window will be shown. Instead just the tkinter dialog is shown
save_as bool False if True, the "save as" dialog is shown which will verify before overwriting
size (int, int) (None, None) (width, height) of the InputText Element or Combo element if using history feature
text_color str None color of the text
RETURN str or None string representing the file(s) chosen, None if cancelled or window closed with X