Display popup with text entry field and browse button so that a folder can be chosen. :param message: message displayed to user :type message: (str) :param title: Window title :type title: (str) :para
(message, title=None, default_path='', no_window=False, size=(None, None), button_color=None,
background_color=None, text_color=None, icon=None, font=None, no_titlebar=False,
grab_anywhere=False, keep_on_top=None, location=(None, None), relative_location=(None, None), initial_folder=None, image=None, modal=True, history=False,
history_setting_filename=None)
| 21231 | |
| 21232 | |
| 21233 | def popup_get_folder(message, title=None, default_path='', no_window=False, size=(None, None), button_color=None, |
| 21234 | background_color=None, text_color=None, icon=None, font=None, no_titlebar=False, |
| 21235 | grab_anywhere=False, keep_on_top=None, location=(None, None), relative_location=(None, None), initial_folder=None, image=None, modal=True, history=False, |
| 21236 | history_setting_filename=None): |
| 21237 | """ |
| 21238 | Display popup with text entry field and browse button so that a folder can be chosen. |
| 21239 | |
| 21240 | :param message: message displayed to user |
| 21241 | :type message: (str) |
| 21242 | :param title: Window title |
| 21243 | :type title: (str) |
| 21244 | :param default_path: path to display to user as starting point (filled into the input field) |
| 21245 | :type default_path: (str) |
| 21246 | :param no_window: if True, no PySimpleGUI window will be shown. Instead just the tkinter dialog is shown |
| 21247 | :type no_window: (bool) |
| 21248 | :param size: (width, height) of the InputText Element |
| 21249 | :type size: (int, int) |
| 21250 | :param button_color: button color (foreground, background) |
| 21251 | :type button_color: (str, str) | str |
| 21252 | :param background_color: color of background |
| 21253 | :type background_color: (str) |
| 21254 | :param text_color: color of the text |
| 21255 | :type text_color: (str) |
| 21256 | :param icon: filename or base64 string to be used for the window's icon |
| 21257 | :type icon: bytes | str |
| 21258 | :param font: specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike |
| 21259 | :type font: (str or (str, int[, str]) or None) |
| 21260 | :param no_titlebar: If True no titlebar will be shown |
| 21261 | :type no_titlebar: (bool) |
| 21262 | :param grab_anywhere: If True: can grab anywhere to move the window (Default = False) |
| 21263 | :type grab_anywhere: (bool) |
| 21264 | :param keep_on_top: If True the window will remain above all current windows |
| 21265 | :type keep_on_top: (bool) |
| 21266 | :param location: Location of upper left corner of the window |
| 21267 | :type location: (int, int) |
| 21268 | :param relative_location: (x,y) location relative to the default location of the window, in pixels. Normally the window centers. This location is relative to the location the window would be created. Note they can be negative. |
| 21269 | :type relative_location: (int, int) |
| 21270 | :param initial_folder: location in filesystem to begin browsing |
| 21271 | :type initial_folder: (str) |
| 21272 | :param image: Image to include at the top of the popup window |
| 21273 | :type image: (str) or (bytes) |
| 21274 | :param modal: If True then makes the popup will behave like a Modal window... all other windows are non-operational until this one is closed. Default = True |
| 21275 | :type modal: bool |
| 21276 | :param history: If True then enable a "history" feature that will display previous entries used. Uses settings filename provided or default if none provided |
| 21277 | :type history: bool |
| 21278 | :param history_setting_filename: Filename to use for the User Settings. Will store list of previous entries in this settings file |
| 21279 | :type history_setting_filename: (str) |
| 21280 | :return: string representing the path chosen, None if cancelled or window closed with X |
| 21281 | :rtype: str | None |
| 21282 | """ |
| 21283 | |
| 21284 | # First setup the history settings file if history feature is enabled |
| 21285 | if history and history_setting_filename is not None: |
| 21286 | try: |
| 21287 | history_settings = UserSettings(history_setting_filename) |
| 21288 | except Exception as e: |
| 21289 | _error_popup_with_traceback('popup_get_folder - Something is wrong with your supplied history settings filename', |
| 21290 | 'Exception: {}'.format(e)) |
no test coverage detected