2018-10-17 15:15:49 +00:00
|
|
|
#!/usr/bin/env python
|
2019-10-23 20:10:03 +00:00
|
|
|
import PySimpleGUI as sg
|
2018-10-17 15:15:49 +00:00
|
|
|
import time
|
|
|
|
|
|
|
|
# Demonstrates a notification window that's partially transparent
|
|
|
|
# The window slowly fades-in
|
|
|
|
# Includes a small red-X button to close the window
|
|
|
|
# Base 64 encoded button is in-lined to avoid reading a file
|
|
|
|
# Free online encoder - https://www.base64-image.de/
|
2019-10-23 20:10:03 +00:00
|
|
|
red_x = "R0lGODlhEAAQAPeQAIsAAI0AAI4AAI8AAJIAAJUAAJQCApkAAJoAAJ4AAJkJCaAAAKYAAKcAAKcCAKcDA6cGAKgAAKsAAKsCAKwAAK0AAK8AAK4CAK8DAqUJAKULAKwLALAAALEAALIAALMAALMDALQAALUAALYAALcEALoAALsAALsCALwAAL8AALkJAL4NAL8NAKoTAKwbAbEQALMVAL0QAL0RAKsREaodHbkQELMsALg2ALk3ALs+ALE2FbgpKbA1Nbc1Nb44N8AAAMIWAMsvAMUgDMcxAKVABb9NBbVJErFYEq1iMrtoMr5kP8BKAMFLAMxKANBBANFCANJFANFEB9JKAMFcANFZANZcANpfAMJUEMZVEc5hAM5pAMluBdRsANR8AM9YOrdERMpIQs1UVMR5WNt8X8VgYMdlZcxtYtx4YNF/btp9eraNf9qXXNCCZsyLeNSLd8SSecySf82kd9qqc9uBgdyBgd+EhN6JgtSIiNuJieGHhOGLg+GKhOKamty1ste4sNO+ueenp+inp+HHrebGrefKuOPTzejWzera1O7b1vLb2/bl4vTu7fbw7ffx7vnz8f///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAJAALAAAAAAQABAAAAjUACEJHEiwYEEABniQKfNFgQCDkATQwAMokEU+PQgUFDAjjR09e/LUmUNnh8aBCcCgUeRmzBkzie6EeQBAoAAMXuA8ciRGCaJHfXzUMCAQgYooWN48anTokR8dQk4sELggBhQrU9Q8evSHiJQgLCIIfMDCSZUjhbYuQkLFCRAMAiOQGGLE0CNBcZYmaRIDLqQFGF60eTRoSxc5jwjhACFWIAgMLtgUocJFy5orL0IQRHAiQgsbRZYswbEhBIiCCH6EiJAhAwQMKU5DjHCi9gnZEHMTDAgAOw=="
|
2018-10-17 15:15:49 +00:00
|
|
|
|
2019-12-24 23:52:47 +00:00
|
|
|
sg.theme('Topanga')
|
2019-10-23 20:10:03 +00:00
|
|
|
sg.set_options(border_width=0, margins=(0, 0))
|
2018-10-17 15:15:49 +00:00
|
|
|
|
2019-10-23 20:10:03 +00:00
|
|
|
layout = [[sg.Text('Notification'+' '*14),
|
|
|
|
sg.CButton('',
|
|
|
|
image_data=red_x,
|
|
|
|
button_color=('#282923', '#282923'))],
|
|
|
|
[sg.Text('You have 6 new emails')], ]
|
2018-10-17 15:15:49 +00:00
|
|
|
|
2019-10-23 20:10:03 +00:00
|
|
|
window = sg.Window('', layout,
|
2018-10-17 15:15:49 +00:00
|
|
|
no_titlebar=True,
|
|
|
|
grab_anywhere=True,
|
|
|
|
keep_on_top=True,
|
2019-10-23 20:10:03 +00:00
|
|
|
alpha_channel=0,
|
|
|
|
finalize=True)
|
2018-10-17 15:15:49 +00:00
|
|
|
|
|
|
|
# Classy fade-in
|
|
|
|
for i in range(1, 75, 2):
|
|
|
|
window.AlphaChannel = float(i)/100
|
|
|
|
time.sleep(.01)
|
|
|
|
|
2019-10-23 20:10:03 +00:00
|
|
|
event, values = window.read()
|
|
|
|
|
|
|
|
window.close()
|