Display Popup with text entry field. Returns the text entered or None if closed / cancelled :param message: message displayed to user :type message: (str) :param title: Window title :type title: (str)
(message, title=None, default_text='', password_char='', 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), image=None, history=False, history_setting_filename=None, modal=True)
| 21613 | # --------------------------- popup_get_text --------------------------- |
| 21614 | |
| 21615 | def popup_get_text(message, title=None, default_text='', password_char='', size=(None, None), button_color=None, |
| 21616 | background_color=None, text_color=None, icon=None, font=None, no_titlebar=False, |
| 21617 | grab_anywhere=False, keep_on_top=None, location=(None, None), relative_location=(None, None), image=None, history=False, history_setting_filename=None, modal=True): |
| 21618 | """ |
| 21619 | Display Popup with text entry field. Returns the text entered or None if closed / cancelled |
| 21620 | |
| 21621 | :param message: message displayed to user |
| 21622 | :type message: (str) |
| 21623 | :param title: Window title |
| 21624 | :type title: (str) |
| 21625 | :param default_text: default value to put into input area |
| 21626 | :type default_text: (str) |
| 21627 | :param password_char: character to be shown instead of actually typed characters. WARNING - if history=True then can't hide passwords |
| 21628 | :type password_char: (str) |
| 21629 | :param size: (width, height) of the input. If not specied a single line Input element used. If height >1 a Mulitline is shown |
| 21630 | :type size: (int, int) |
| 21631 | :param button_color: Color of the button (text, background) |
| 21632 | :type button_color: (str, str) | str |
| 21633 | :param background_color: background color of the entire window |
| 21634 | :type background_color: (str) |
| 21635 | :param text_color: color of the message text |
| 21636 | :type text_color: (str) |
| 21637 | :param icon: filename or base64 string to be used for the window's icon |
| 21638 | :type icon: bytes | str |
| 21639 | :param font: specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike |
| 21640 | :type font: (str or (str, int[, str]) or None) |
| 21641 | :param no_titlebar: If True no titlebar will be shown |
| 21642 | :type no_titlebar: (bool) |
| 21643 | :param grab_anywhere: If True can click and drag anywhere in the window to move the window |
| 21644 | :type grab_anywhere: (bool) |
| 21645 | :param keep_on_top: If True the window will remain above all current windows |
| 21646 | :type keep_on_top: (bool) |
| 21647 | :param location: (x,y) Location on screen to display the upper left corner of window |
| 21648 | :type location: (int, int) |
| 21649 | :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. |
| 21650 | :type relative_location: (int, int) |
| 21651 | :param image: Image to include at the top of the popup window |
| 21652 | :type image: (str) or (bytes) |
| 21653 | :param history: If True then enable a "history" feature that will display previous entries used. Uses settings filename provided or default if none provided |
| 21654 | :type history: bool |
| 21655 | :param history_setting_filename: Filename to use for the User Settings. Will store list of previous entries in this settings file |
| 21656 | :type history_setting_filename: (str) |
| 21657 | :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 |
| 21658 | :type modal: bool |
| 21659 | :return: Text entered or None if window was closed or cancel button clicked |
| 21660 | :rtype: str | None |
| 21661 | """ |
| 21662 | |
| 21663 | # First setup the history settings file if history feature is enabled |
| 21664 | if history and history_setting_filename is not None: |
| 21665 | try: |
| 21666 | history_settings = UserSettings(history_setting_filename) |
| 21667 | except Exception as e: |
| 21668 | _error_popup_with_traceback('popup_get_file - Something is wrong with your supplied history settings filename', |
| 21669 | 'Exception: {}'.format(e)) |
| 21670 | return None |
| 21671 | elif history: |
| 21672 | history_settings_filename = os.path.basename(inspect.stack()[1].filename) |
no test coverage detected