()
| 77 | |
| 78 | |
| 79 | def main(): |
| 80 | # sg.theme('light green 3') |
| 81 | # sg.theme('dark red') |
| 82 | # sg.theme('dark green 3') |
| 83 | sg.theme('light brown 10') |
| 84 | |
| 85 | title = 'Customized Titlebar Window' |
| 86 | # Here the titlebar colors are based on the theme. A few suggestions are shown. Try each of them |
| 87 | layout = [title_bar(title, sg.theme_button_color()[0], sg.theme_button_color()[1]), |
| 88 | # title_bar(title, sg.theme_button_color()[1], sg.theme_slider_color()), |
| 89 | # title_bar(title, sg.theme_slider_color(), sg.theme_button_color()[0]), |
| 90 | [sg.T('This is normal window text. The above is the fake "titlebar"')], |
| 91 | [sg.T('Input something:')], |
| 92 | [sg.Input(key='-IN-'), sg.Text(size=(12, 1), key='-OUT-')], |
| 93 | [sg.Button('Go')]] |
| 94 | |
| 95 | window_main = sg.Window(title, layout, resizable=True, no_titlebar=True, grab_anywhere=True, keep_on_top=True, margins=(0, 0), finalize=True) |
| 96 | |
| 97 | window_main['-TITLEBAR-'].expand(True, False, False) # expand the titlebar's rightmost column so that it resizes correctly |
| 98 | counter = 0 |
| 99 | while True: # Event Loop |
| 100 | window, event, values = sg.read_all_windows(timeout=100) |
| 101 | if event == sg.WIN_CLOSED or event == 'Exit': |
| 102 | break |
| 103 | |
| 104 | # ------ events to handle minimize and restore of window ------ |
| 105 | if event == '-MINIMIZE-': |
| 106 | minimize_main_window(window_main) |
| 107 | continue |
| 108 | elif event == '-RESTORE-' or (event == sg.WINDOW_CLOSED and window != window_main): |
| 109 | restore_main_window(window_main) |
| 110 | continue |
| 111 | |
| 112 | # ------ remainder of your "normal" events and window code ------ |
| 113 | window_main['-OUT-'].update(counter) |
| 114 | counter += 1 |
| 115 | window.close() |
| 116 | |
| 117 | |
| 118 | if __name__ == '__main__': |
no test coverage detected