MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / popup_animated

Function popup_animated

PySimpleGUI/PySimpleGUI.py:21902–21975  ·  view source on GitHub ↗

Show animation one frame at a time. This function has its own internal clocking meaning you can call it at any frequency and the rate the frames of video is shown remains constant. Maybe your frames update every 30 ms but your event loop is running every 10 ms. You don't have to w

(image_source, message=None, background_color=None, text_color=None, font=None, no_titlebar=True, grab_anywhere=True, keep_on_top=True,
                   location=(None, None), relative_location=(None, None), alpha_channel=None, time_between_frames=0, transparent_color=None, title='', icon=None, no_buffering=False)

Source from the content-addressed store, hash-verified

21900# --------------------------- PopupAnimated ---------------------------
21901
21902def popup_animated(image_source, message=None, background_color=None, text_color=None, font=None, no_titlebar=True, grab_anywhere=True, keep_on_top=True,
21903 location=(None, None), relative_location=(None, None), alpha_channel=None, time_between_frames=0, transparent_color=None, title='', icon=None, no_buffering=False):
21904 """
21905 Show animation one frame at a time. This function has its own internal clocking meaning you can call it at any frequency
21906 and the rate the frames of video is shown remains constant. Maybe your frames update every 30 ms but your
21907 event loop is running every 10 ms. You don't have to worry about delaying, just call it every time through the
21908 loop.
21909
21910 :param image_source: Either a filename or a base64 string. Use None to close the window.
21911 :type image_source: str | bytes | None
21912 :param message: An optional message to be shown with the animation
21913 :type message: (str)
21914 :param background_color: color of background
21915 :type background_color: (str)
21916 :param text_color: color of the text
21917 :type text_color: (str)
21918 :param font: specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
21919 :type font: str | tuple
21920 :param no_titlebar: If True then the titlebar and window frame will not be shown
21921 :type no_titlebar: (bool)
21922 :param grab_anywhere: If True then you can move the window just clicking anywhere on window, hold and drag
21923 :type grab_anywhere: (bool)
21924 :param keep_on_top: If True then Window will remain on top of all other windows currently shownn
21925 :type keep_on_top: (bool)
21926 :param location: (x,y) location on the screen to place the top left corner of your window. Default is to center on screen
21927 :type location: (int, int)
21928 :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.
21929 :type relative_location: (int, int)
21930 :param alpha_channel: Window transparency 0 = invisible 1 = completely visible. Values between are see through
21931 :type alpha_channel: (float)
21932 :param time_between_frames: Amount of time in milliseconds between each frame
21933 :type time_between_frames: (int)
21934 :param transparent_color: This color will be completely see-through in your window. Can even click through
21935 :type transparent_color: (str)
21936 :param title: Title that will be shown on the window
21937 :type title: (str)
21938 :param icon: Same as Window icon parameter. Can be either a filename or Base64 byte string. For Windows if filename, it MUST be ICO format. For Linux, must NOT be ICO
21939 :type icon: str | bytes
21940 :param no_buffering: If True then no buffering will be used for the GIF. May work better if you have a large animation
21941 :type no_buffering: (bool)
21942 :return: True if the window updated OK. False if the window was closed or if the GIF has reached the end
21943 :rtype: bool
21944 """
21945 if image_source is None:
21946 for image in Window._animated_popup_dict:
21947 window = Window._animated_popup_dict[image]
21948 window.close()
21949 Window._animated_popup_dict = {}
21950 return False
21951 not_done = True
21952 if image_source not in Window._animated_popup_dict:
21953 if type(image_source) is bytes or len(image_source) > 300:
21954 layout = [[Image(data=image_source, background_color=background_color, key='-IMAGE-')], ]
21955 else:
21956 layout = [[Image(filename=image_source, background_color=background_color, key='-IMAGE-', )], ]
21957 if message:
21958 layout.append([Text(message, background_color=background_color, text_color=text_color, font=font)])
21959

Callers 1

shell_with_animationFunction · 0.85

Calls 7

closeMethod · 0.95
readMethod · 0.95
ImageClass · 0.85
TextClass · 0.85
WindowClass · 0.85
update_animationMethod · 0.80

Tested by

no test coverage detected