Popup
popup
Popup - Display a popup Window with as many parms as you wish to include. This is the GUI equivalent of the "print" statement. It's also great for "pausing" your program's flow until the user can read some error messages.
If this popup doesn't have the features you want, then you can easily make your own. Popups can be accomplished in 1 line of code: choice, _ = sg.Window('Continue?', [[sg.T('Do you want to continue?')], [sg.Yes(s=10), sg.No(s=10)]], disable_close=True).read(close=True)
popup(
args = *<1 or N objects>,
button_color = None,
background_color = None,
text_color = None,
button_type = 0,
auto_close = False,
auto_close_duration = None,
custom_text = (None, None),
non_blocking = False,
icon = "default_icon.ico",
line_width = None,
font = None,
no_titlebar = False,
grab_anywhere = False,
keep_on_top = False,
location = (None, None)
)
Parameter Descriptions
Name | Type | Default | Description |
---|---|---|---|
*args | Any | Variable number of your arguments. Load up the call with stuff to see! | |
auto_close | bool | False | If True the window will automatically close |
auto_close_duration | int | None | time in seconds to keep window open before closing it automatically |
background_color | str | None | Window's background color |
button_color | (str, str) or None | None | Color of the buttons shown (text color, button color) |
button_type | int | 0 | NOT USER SET! Determines which pre-defined buttons will be shown (Default value = POPUP_BUTTONS_OK). There are many Popup functions and they call Popup, changing this parameter to get the desired effect. |
custom_text | (str, str) or str | (None, None) | A string or pair of strings that contain the text to display on the buttons |
font | str or Tuple[font_name, size, modifiers] | 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. If no_titlebar is True, grab_anywhere should likely be enabled too |
icon | str or bytes | default_icon.ico | icon to display on the window. Same format as a Window call |
keep_on_top | bool | False | If True the window will remain above all current windows |
line_width | int | None | Width of lines in characters. Defaults to MESSAGE_BOX_LINE_WIDTH |
location | (int, int) | (None, None) | Location on screen to display the top left corner of window. Defaults to window centered on screen |
no_titlebar | bool | False | If True will not show the frame around the window and the titlebar across the top |
non_blocking | bool | False | If True then will immediately return from the function without waiting for the user's input. |
text_color | str | None | text color |
title | str | Optional title for the window. If none provided, the first arg will be used instead. | |
RETURN | str or None | Returns text of the button that was pressed. None will be returned if user closed window with X |