Updated to use more recent design patterns.

This commit is contained in:
PySimpleGUI 2019-11-19 11:54:35 -05:00
parent 2cfd2f19b1
commit 59274592ca
1 changed files with 5 additions and 6 deletions

View File

@ -46,16 +46,15 @@ class QueueHandler(logging.Handler):
def main(): def main():
layout = [ layout = [
[sg.MLine(size=(50, 15), key='Log')], [sg.Multiline(size=(50, 15), key='-LOG-')],
[sg.Button('Start', bind_return_key=True, key='-START-'), sg.Button('Exit')] [sg.Button('Start', bind_return_key=True, key='-START-'), sg.Button('Exit')]
] ]
window = sg.FlexForm('Log window', layout, window = sg.Window('Log window', layout,
default_element_size=(30, 2), default_element_size=(30, 2),
font=('Helvetica', ' 10'), font=('Helvetica', ' 10'),
default_button_element_size=(8, 2), default_button_element_size=(8, 2),)
return_keyboard_events=True)
window.read(timeout=0)
appStarted = False appStarted = False
# Setup logging and start app # Setup logging and start app
@ -86,7 +85,7 @@ def main():
pass pass
else: else:
msg = queue_handler.format(record) msg = queue_handler.format(record)
window['Log'].update(msg+'\n', append=True) window['-LOG-'].update(msg+'\n', append=True)
window.close() window.close()