|
9 | 9 | import os |
10 | 10 | import pyfiglet |
11 | 11 |
|
12 | | -version = '6.0' |
| 12 | +version = '6.0.1' |
13 | 13 | __version__ = version.split()[0] |
14 | 14 |
|
15 | 15 | """ |
|
18 | 18 | 5.0.0 13-Feb-2024 Initial release with PSG 5 |
19 | 19 | 6.0 9-Apr-2026 Moved to LGPL3 license |
20 | 20 | Added "favorites" feature |
21 | | -
|
| 21 | +6.0.1 10-Apr-2026 Made Font list expand/contract with window. Sort favorites. |
22 | 22 | """ |
23 | 23 |
|
24 | 24 |
|
@@ -128,19 +128,19 @@ def make_window(): |
128 | 128 | sg.theme_background_color(sg.theme_input_background_color()) |
129 | 129 | sg.theme_text_element_background_color(sg.theme_input_background_color()) |
130 | 130 | column_left = [[sg.Table(headings=['Font Name'], values=fonts, key='-FONT-LIST-', |
131 | | - col_widths=[40], num_rows=30, enable_events=True), sg.VerticalSeparator(pad=((5, 5), 0))]] |
| 131 | + col_widths=[40], num_rows=30, enable_events=True, expand_y=True), sg.VerticalSeparator(pad=((5, 5), 0))]] |
132 | 132 | try: |
133 | 133 | mline_input = sg.Multiline('PySimpleGUI', size=(40, 3), key='-TEXT-TO-SHOW-', no_scrollbar=True, enable_events=True, focus=True) |
134 | 134 | except Exception as e: |
135 | 135 | mline_input = sg.Multiline('PySimpleGUI', size=(40, 3), key='-TEXT-TO-SHOW-', enable_events=True, focus=True) |
136 | 136 |
|
137 | | - column_right = [[sg.Combo(favorite_fonts, default_value=favorite_fonts[0], readonly=True, enable_events=True, k='-FAVORITES-', size=(max([len(f) for f in favorite_fonts]), len(favorite_fonts))), sg.Text("Font Name:", size=(10, 1)), sg.Input(selected_font, size=(12, 1), key='-FONT-NAME-'), sg.B('Add to favorites', k='-ADD TO FAVORITES-'), sg.B('Clear favorites', k='-CLEAR FAVORITES-')], |
| 137 | + column_right = [[sg.Combo(favorite_fonts, default_value=favorite_fonts[0], readonly=True, enable_events=True, k='-FAVORITES-', size=(max([len(f) for f in favorite_fonts]),30)), sg.Text("Font Name:", size=(10, 1)), sg.Input(selected_font, size=(12, 1), key='-FONT-NAME-'), sg.B('Add to favorites', k='-ADD TO FAVORITES-'), sg.B('Clear favorites', k='-CLEAR FAVORITES-')], |
138 | 138 | [sg.Text("Text:", size=(10, 1)), mline_input, sg.T('Font size for display below'), |
139 | 139 | sg.Combo(list(range(4, 20)), 12, enable_events=True, k='-FONT-SIZE-')], |
140 | 140 | [sg.Multiline(size=(LINE_LENGTH, 20), key='-OUTPUT-', border_width=0, font=MULTILINE_FONT, expand_x=True, expand_y=True, pad=(40, 40), )], |
141 | 141 | [sg.B('Copy to Clipboard'), sg.B('Change Theme')], ] |
142 | 142 |
|
143 | | - layout = [[sg.Column(column_left, expand_y=False, expand_x=False), sg.Column(column_right, expand_x=False, expand_y=False, k='-COL R-')], |
| 143 | + layout = [[sg.Column(column_left, expand_y=True, expand_x=False), sg.Column(column_right, expand_x=False, expand_y=False, k='-COL R-')], |
144 | 144 | [sg.Button('Exit', right_click_menu=sg.MENU_RIGHT_CLICK_DISABLED), |
145 | 145 | sg.T('PySimpleGUI ver ' + sg.version.split(' ')[0] + ' tkinter ver ' + sg.tclversion_detailed + ' Python ver ' + sys.version, font='Default 8', |
146 | 146 | pad=(0, 0))], ] |
@@ -177,6 +177,7 @@ def main(): |
177 | 177 | MULTILINE_FONT = ('Courier', 12) |
178 | 178 | fonts = pyfiglet.FigletFont.getFonts() |
179 | 179 | favorite_fonts = sg.user_settings_get_entry('-favorites-', [' ']) |
| 180 | + favorite_fonts.sort() |
180 | 181 |
|
181 | 182 | while True: # Event Loop |
182 | 183 | event, values = window.read() |
@@ -217,6 +218,7 @@ def main(): |
217 | 218 | elif event == '-ADD TO FAVORITES-': |
218 | 219 | favorite_fonts.append(values['-FONT-NAME-']) |
219 | 220 | favorite_fonts = list(set(favorite_fonts)) # remove dupes |
| 221 | + favorite_fonts.sort() |
220 | 222 | sg.user_settings_set_entry('-favorites-', favorite_fonts) |
221 | 223 | window['-FAVORITES-'].update(value=values['-FONT-NAME-'], values=favorite_fonts) |
222 | 224 | elif event == '-CLEAR FAVORITES-': |
|
0 commit comments