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
(*args, title=None, button_color=None, background_color=None, text_color=None, button_type=POPUP_BUTTONS_OK, auto_close=False,
auto_close_duration=None, custom_text=(None, None), non_blocking=False, icon=None, line_width=None, font=None, no_titlebar=False, grab_anywhere=False,
keep_on_top=None, location=(None, None), relative_location=(None, None), any_key_closes=False, image=None, modal=True, button_justification=None, drop_whitespace=True)
| 20335 | # ----------------------------------- The mighty Popup! ------------------------------------------------------------ # |
| 20336 | |
| 20337 | def popup(*args, title=None, button_color=None, background_color=None, text_color=None, button_type=POPUP_BUTTONS_OK, auto_close=False, |
| 20338 | auto_close_duration=None, custom_text=(None, None), non_blocking=False, icon=None, line_width=None, font=None, no_titlebar=False, grab_anywhere=False, |
| 20339 | keep_on_top=None, location=(None, None), relative_location=(None, None), any_key_closes=False, image=None, modal=True, button_justification=None, drop_whitespace=True): |
| 20340 | """ |
| 20341 | Popup - Display a popup Window with as many parms as you wish to include. This is the GUI equivalent of the |
| 20342 | "print" statement. It's also great for "pausing" your program's flow until the user can read some error messages. |
| 20343 | |
| 20344 | 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: |
| 20345 | 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) |
| 20346 | |
| 20347 | |
| 20348 | :param *args: Variable number of your arguments. Load up the call with stuff to see! |
| 20349 | :type *args: (Any) |
| 20350 | :param title: Optional title for the window. If none provided, the first arg will be used instead. |
| 20351 | :type title: (str) |
| 20352 | :param button_color: Color of the buttons shown (text color, button color) |
| 20353 | :type button_color: (str, str) | str |
| 20354 | :param background_color: Window's background color |
| 20355 | :type background_color: (str) |
| 20356 | :param text_color: text color |
| 20357 | :type text_color: (str) |
| 20358 | :param button_type: 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. |
| 20359 | :type button_type: (int) |
| 20360 | :param auto_close: If True the window will automatically close |
| 20361 | :type auto_close: (bool) |
| 20362 | :param auto_close_duration: time in seconds to keep window open before closing it automatically |
| 20363 | :type auto_close_duration: (int) |
| 20364 | :param custom_text: A string or pair of strings that contain the text to display on the buttons |
| 20365 | :type custom_text: (str, str) | str |
| 20366 | :param non_blocking: If True then will immediately return from the function without waiting for the user's input. |
| 20367 | :type non_blocking: (bool) |
| 20368 | :param icon: icon to display on the window. Same format as a Window call |
| 20369 | :type icon: str | bytes |
| 20370 | :param line_width: Width of lines in characters. Defaults to MESSAGE_BOX_LINE_WIDTH |
| 20371 | :type line_width: (int) |
| 20372 | :param font: specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike |
| 20373 | :type font: str | Tuple[font_name, size, modifiers] |
| 20374 | :param no_titlebar: If True will not show the frame around the window and the titlebar across the top |
| 20375 | :type no_titlebar: (bool) |
| 20376 | :param grab_anywhere: If True can grab anywhere to move the window. If no_titlebar is True, grab_anywhere should likely be enabled too |
| 20377 | :type grab_anywhere: (bool) |
| 20378 | :param location: Location on screen to display the top left corner of window. Defaults to window centered on screen |
| 20379 | :type location: (int, int) |
| 20380 | :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. |
| 20381 | :type relative_location: (int, int) |
| 20382 | :param keep_on_top: If True the window will remain above all current windows |
| 20383 | :type keep_on_top: (bool) |
| 20384 | :param any_key_closes: If True then will turn on return_keyboard_events for the window which will cause window to close as soon as any key is pressed. Normally the return key only will close the window. Default is false. |
| 20385 | :type any_key_closes: (bool) |
| 20386 | :param image: Image to include at the top of the popup window |
| 20387 | :type image: (str) or (bytes) |
| 20388 | :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 |
| 20389 | :type modal: bool |
| 20390 | :param right_justify_buttons: If True then the buttons will be "pushed" to the right side of the Window |
| 20391 | :type right_justify_buttons: bool |
| 20392 | :param button_justification: Speficies if buttons should be left, right or centered. Default is left justified |
| 20393 | :type button_justification: str |
| 20394 | :param drop_whitespace: Controls is whitespace should be removed when wrapping text. Parameter is passed to textwrap.fill. Default is to drop whitespace (so popup remains backward compatible) |
no test coverage detected