| 50 | |
| 51 | |
| 52 | def make_window(): |
| 53 | |
| 54 | screen_background_color = sg.user_settings_get_entry('-screen color-', DEFAULT_SCREEN_BACKGROUND_COLOR) |
| 55 | old_bg = sg.theme_background_color() |
| 56 | sg.theme_background_color(screen_background_color) |
| 57 | button_row = [] |
| 58 | for item in launcher_buttons.keys(): |
| 59 | tip = 'Grab anywhere to move the launcher\nClick an item to launch something\nRight Click to get to settings' |
| 60 | if isinstance(item, bytes): |
| 61 | button = sg.Button(image_data=item, key=item, metadata=launcher_buttons[item], button_color=screen_background_color,tooltip=tip, border_width=0) |
| 62 | else: |
| 63 | button = sg.Button(item, key=item, metadata=launcher_buttons[item], tooltip=tip, border_width=0) |
| 64 | button_row.append(button) |
| 65 | |
| 66 | col_buttons = sg.Column([button_row], p=0, k='-BUTTON COL-') |
| 67 | col_minimized = sg.Column([[sg.Button(image_data=MINIMIZED_IMAGE, k='-MINIMIZED IMAGE-', button_color=sg.theme_background_color(), border_width=0)]], visible=False, k='-MINIMIZED COL-') |
| 68 | |
| 69 | layout = [[sg.pin(col_minimized), sg.pin(col_buttons)]] |
| 70 | |
| 71 | screen_size = sg.Window.get_screen_size() |
| 72 | location = screen_size[0] // 2, screen_size[1] - 200 # set a default location centered and near the bottom of the screen |
| 73 | location = sg.user_settings_get_entry('-window location-', location) |
| 74 | keep_on_top = sg.user_settings_get_entry('-keep on top-', True) |
| 75 | |
| 76 | |
| 77 | |
| 78 | window = sg.Window('Window Title', layout, location=location, |
| 79 | keep_on_top=keep_on_top, no_titlebar=True, grab_anywhere=True, background_color=screen_background_color, |
| 80 | auto_size_buttons=False, default_button_element_size=DEFAULT_BUTTON_SIZE, right_click_menu=sg.MENU_RIGHT_CLICK_EDITME_VER_SETTINGS_EXIT, |
| 81 | enable_close_attempted_event=True, use_default_focus=False) |
| 82 | sg.theme_background_color(old_bg) |
| 83 | |
| 84 | return window |
| 85 | |
| 86 | |
| 87 | def main(): |