45 lines
8.5 KiB
Python
45 lines
8.5 KiB
Python
#!/usr/bin/env python
|
|
import sys
|
|
import time
|
|
import PySimpleGUI as sg
|
|
|
|
|
|
def show_win():
|
|
sg.set_options(border_width=0, margins=(0, 0), element_padding=(5, 3))
|
|
|
|
frame_layout = [
|
|
[sg.Button('', image_data=mac_red,
|
|
button_color=('white', sg.COLOR_SYSTEM_DEFAULT), key='-exit-'),
|
|
sg.Button('', image_data=mac_orange,
|
|
button_color=('white', sg.COLOR_SYSTEM_DEFAULT)),
|
|
sg.Button('', image_data=mac_green,
|
|
button_color=('white', sg.COLOR_SYSTEM_DEFAULT), key='-minimize-'),
|
|
sg.Text(' '*40)], ]
|
|
|
|
layout = [[sg.Frame('', frame_layout)],
|
|
[sg.Text('')],
|
|
[sg.Text('My Mac-alike window', size=(25, 2))], ]
|
|
|
|
window = sg.Window('My new window', layout,
|
|
no_titlebar=True, grab_anywhere=True,
|
|
alpha_channel=0, finalize=True)
|
|
|
|
for i in range(100):
|
|
window.set_alpha(i/100)
|
|
time.sleep(.01)
|
|
|
|
while True: # Event Loop
|
|
event, values = window.read()
|
|
if event is None or event == '-exit-':
|
|
break
|
|
if event == '-minimize-':
|
|
# window.Minimize() # cannot minimize a window with no titlebar
|
|
pass
|
|
print(event, values)
|
|
|
|
|
|
mac_red = 'iVBORw0KGgoAAAANSUhEUgAAABgAAAAZCAYAAAArK+5dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAGHRFWHRTb2Z0d2FyZQBwYWludC5uZXQgNC4xLjFjKpxLAAAGfklEQVR42o1W6VNTVxR/Kv4Htp1xZA0JhCWsAQmQAC4Yd0GtKBqXUUAREBdE8pYAWVhUotVWVOpGpzpVqI51pnas+sFtOnXUmXY6o10sErYASUAgybun5yUEoWOnfvjNOe/dc35nufe9cymO4ygBLMt6JMey01mansmaTJS5sVFRrdlsrpq/0LVNEk62RkTB5vBIvjBKRiqyFz0zlpQydUeOUFU6HcVoaT8fzwQXYgo5yzDTWGGhtpY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