1616# sg.theme('Dark Grey 13') # uncommment to see how a particular theme looks
1717
1818NAME_SIZE = 23
19+ use_custom_titlebar = False
1920
2021def make_window (theme = None ):
2122
@@ -32,7 +33,7 @@ def name(name):
3233 treedata .Insert ("_A_" , '_A1_' , 'Sub Item 1' , ['can' , 'be' , 'anything' ], )
3334 treedata .Insert ("" , '_C_' , 'C' , [], )
3435
35- layout_l = [[ sg . Menu ([[ 'File' , [ 'Exit' ]], [ 'Edit' , [ 'Edit Me' , ]]])],
36+ layout_l = [
3637 [name ('Text' ), sg .Text ('Text' )],
3738 [name ('Input' ), sg .Input (s = 15 )],
3839 [name ('Multiline' ), sg .Multiline (s = (15 ,2 ))],
@@ -65,16 +66,19 @@ def name(name):
6566 [name ('StatusBar' ), sg .StatusBar ('StatusBar' )],
6667 [name ('Sizegrip' ), sg .Sizegrip ()] ]
6768
68- layout = [[sg .T ('PySimpleGUI Elements - Use Combo to Change Themes' , font = '_ 18' , justification = 'c' , expand_x = True )],
69+ layout = [[sg .MenubarCustom ([['File' , ['Exit' ]], ['Edit' , ['Edit Me' , ]]], k = '-CUST MENUBAR-' ,p = 0 )] if use_custom_titlebar else [sg .Menu ([['File' , ['Exit' ]], ['Edit' , ['Edit Me' , ]]], k = '-CUST MENUBAR-' ,p = 0 )],
70+ [sg .Checkbox ('Use Custom Titlebar & Menubar' , use_custom_titlebar , enable_events = True , k = '-USE CUSTOM TITLEBAR-' )],
71+ [sg .T ('PySimpleGUI Elements - Use Combo to Change Themes' , font = '_ 18' , justification = 'c' , expand_x = True )],
6972 [sg .Col (layout_l ), sg .Col (layout_r )]]
70- window = sg .Window ('The PySimpleGUI Element List' , layout , finalize = True , right_click_menu = sg .MENU_RIGHT_CLICK_EDITME_EXIT )
71-
73+ window = sg .Window ('The PySimpleGUI Element List' , layout , finalize = True , right_click_menu = sg .MENU_RIGHT_CLICK_EDITME_VER_EXIT , keep_on_top = True , use_custom_titlebar = use_custom_titlebar )
7274 window ['-PBAR-' ].update (30 )
7375 window ['-GRAPH-' ].draw_image (data = sg .EMOJI_BASE64_HAPPY_JOY , location = (0 ,50 ))
7476
7577 return window
7678
7779def main ():
80+ global use_custom_titlebar
81+
7882 window = make_window ()
7983
8084 while True :
@@ -87,6 +91,12 @@ def main():
8791 sg .theme (values ['-COMBO-' ])
8892 window .close ()
8993 window = make_window ()
94+ if event == '-USE CUSTOM TITLEBAR-' :
95+ use_custom_titlebar = values ['-USE CUSTOM TITLEBAR-' ]
96+ window .close ()
97+ window = make_window ()
98+ elif event == 'Version' :
99+ sg .popup_scrolled (sg .get_versions (), keep_on_top = True , non_blocking = True )
90100 window .close ()
91101
92102
0 commit comments