Skip to content

Commit eddf5bc

Browse files
New Window parameter transparent_color. PopupAnimated now uses a transparent background!
1 parent 9dc029e commit eddf5bc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

PySimpleGUI.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6206,7 +6206,7 @@ def StartupTK(my_flex_form:Window):
62066206
my_flex_form.SetIcon(my_flex_form.WindowIcon)
62076207

62086208
try:
6209-
root.attributes('-alpha', my_flex_form.AlphaChannel) # Make window visible again
6209+
root.attributes('-alpha', 1 if my_flex_form.AlphaChannel is None else my_flex_form.AlphaChannel) # Make window visible again
62106210
except:
62116211
pass
62126212

@@ -7666,7 +7666,7 @@ def PopupGetText(message, title=None, default_text='', password_char='', size=(N
76667666

76677667
# --------------------------- PopupAnimated ---------------------------
76687668

7669-
def PopupAnimated(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), alpha_channel=.8, time_between_frames=0):
7669+
def PopupAnimated(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), alpha_channel=None, time_between_frames=0, transparent_color=None):
76707670

76717671
if image_source is None:
76727672
for image in Window.animated_popup_dict:
@@ -7676,15 +7676,15 @@ def PopupAnimated(image_source, message=None, background_color=None, text_color=
76767676
return
76777677

76787678
if image_source not in Window.animated_popup_dict:
7679-
if type(image_source) is bytes:
7679+
if type(image_source) is bytes or len(image_source)>200:
7680+
print('Animating data')
76807681
layout = [[Image(data=image_source, background_color=background_color, key='_IMAGE_',)],]
76817682
else:
76827683
layout = [[Image(filename=image_source, background_color=background_color, key='_IMAGE_',)],]
76837684
if message:
76847685
layout.append([Text(message, background_color=background_color, text_color=text_color, font=font)])
76857686

7686-
window = Window('Animated GIF', no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top,
7687-
background_color=background_color, location=location, alpha_channel=alpha_channel, element_padding=(0,0), margins=(0,0)).Layout(layout).Finalize()
7687+
window = Window('Animated GIF', layout, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, background_color=background_color, location=location, alpha_channel=alpha_channel, element_padding=(0,0), margins=(0,0), transparent_color=transparent_color).Finalize()
76887688
Window.animated_popup_dict[image_source] = window
76897689
else:
76907690
window = Window.animated_popup_dict[image_source]

0 commit comments

Comments
 (0)