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

Function notify_popout

DemoPrograms/Demo_Notify_Integration.py:33–60  ·  view source on GitHub ↗

Show a notification popout window :param title: Title shown in the notification :param message: Message shown in the notification :param icon: Icon shown in the notification - defaults to PySimpleGUI icon. Should be a PNG file :param app_name: Application name shown in the noti

(title=None, message=None, icon=sg.DEFAULT_BASE64_ICON, app_name=None)

Source from the content-addressed store, hash-verified

31
32
33def notify_popout(title=None, message=None, icon=sg.DEFAULT_BASE64_ICON, app_name=None):
34 """
35 Show a notification popout window
36
37 :param title: Title shown in the notification
38 :param message: Message shown in the notification
39 :param icon: Icon shown in the notification - defaults to PySimpleGUI icon. Should be a PNG file
40 :param app_name: Application name shown in the notification
41 """
42 if not hasattr(notify_popout, 'temp_files'):
43 notify_popout.temp_files = []
44
45 notification = Notify()
46 notification.title = title
47 notification.message = message
48 tmp = None
49 if isinstance(icon, bytes):
50 with tempfile.TemporaryFile(suffix='.png', delete=False) as tmp:
51 tmp.write(base64.b64decode(icon))
52 tmp.close()
53 notification.icon = tmp.name
54 elif icon is not None:
55 notification.icon = icon
56 if app_name is not None:
57 notification.application_name = app_name
58 notification.send(block=False)
59 if tmp is not None:
60 notify_popout.temp_files.append(tmp.name)
61
62
63def main():

Callers 1

mainFunction · 0.85

Calls 2

writeMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected