Merge pull request #2045 from PySimpleGUI/Dev-latest

Enable SetGlobalIcon to be a base64 byte string in addition to a file…
This commit is contained in:
PySimpleGUI 2019-10-02 23:12:11 -04:00 committed by GitHub
commit 1e4e6612f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 11 deletions

View File

@ -5160,7 +5160,12 @@ class Window:
self.Font = font if font else DEFAULT_FONT
self.RadioDict = {}
self.BorderDepth = border_depth
self.WindowIcon = Window.user_defined_icon if Window.user_defined_icon is not None else icon if icon is not None else DEFAULT_WINDOW_ICON
if icon:
self.WindowIcon = icon
elif Window.user_defined_icon is not None:
self.WindowIcon = Window.user_defined_icon
else:
self.WindowIcon = DEFAULT_WINDOW_ICON
self.AutoClose = auto_close
self.NonBlocking = False
self.TKroot = None
@ -9385,20 +9390,13 @@ def EasyPrintClose():
# ===================================================#
def SetGlobalIcon(icon):
"""
Sets the icon which will be used any time a window is created if an icon is not provided when the
window is created.
:param icon:
:param icon: Union[bytes, str] Either a Base64 byte string or a filename
"""
# global _my_windows
try:
with open(icon, 'r') as icon_file:
pass
except:
raise FileNotFoundError
# _my_windows.user_defined_icon = icon
Window.user_defined_icon = icon
return True
# ============================== SetOptions =========#