Merge pull request #4347 from PySimpleGUI/Dev-latest

Couple of fixes for getting location of popups
This commit is contained in:
PySimpleGUI 2021-05-31 15:55:05 -04:00 committed by GitHub
commit 0a92422231
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -394,7 +394,7 @@ def main():
current_goal = current_goal if current_goal != 0 else 100 current_goal = current_goal if current_goal != 0 else 100
sg.user_settings_set_entry('-goal-', current_goal) sg.user_settings_set_entry('-goal-', current_goal)
elif event == 'Choose Title': elif event == 'Choose Title':
new_title = sg.popup_get_text('Choose a title for your date', location=window.current_location(), keep_on_top=True) new_title = sg.popup_get_text('Choose a title for your date', default_text=sg.user_settings_get_entry('-title-', '') , location=window.current_location(), keep_on_top=True)
if new_title is not None: if new_title is not None:
window['-TITLE-'].update(new_title) window['-TITLE-'].update(new_title)
sg.user_settings_set_entry('-title-', new_title) sg.user_settings_set_entry('-title-', new_title)
@ -409,13 +409,15 @@ def main():
# this is result of hacking code down to 99 lines in total. Not tried it before. Interesting test. # this is result of hacking code down to 99 lines in total. Not tried it before. Interesting test.
_, window = window.close(), make_window(loc) _, window = window.close(), make_window(loc)
elif event == 'Set Main Font': elif event == 'Set Main Font':
font = sg.popup_get_text('Main Information Font and Size (e.g. courier 70)', default_text=sg.user_settings_get_entry('-main number font-'), keep_on_top=True) font = sg.popup_get_text('Main Information Font and Size (e.g. courier 70)', default_text=sg.user_settings_get_entry('-main number font-', main_number_font),location=window.current_location(), keep_on_top=True)
if font: if font:
loc = window.current_location()
sg.user_settings_set_entry('-main number font-', font) sg.user_settings_set_entry('-main number font-', font)
_, window = window.close(), make_window(loc) _, window = window.close(), make_window(loc)
elif event == 'Set Title Font': elif event == 'Set Title Font':
font = sg.popup_get_text('Title Font and Size (e.g. courier 8)', default_text=sg.user_settings_get_entry('-title font-'), keep_on_top=True) font = sg.popup_get_text('Title Font and Size (e.g. courier 8)', default_text=sg.user_settings_get_entry('-title font-', title_font), location=window.current_location(), keep_on_top=True)
if font: if font:
loc = window.current_location()
sg.user_settings_set_entry('-title font-', font) sg.user_settings_set_entry('-title font-', font)
_, window = window.close(), make_window(loc) _, window = window.close(), make_window(loc)