Major demo refresh.. switched everything to new function names, new design patterns

Out with the old, in with the new!!
This commit is contained in:
MikeTheWatchGuy 2018-09-24 18:01:00 -04:00
parent 2a06683383
commit a1f4c60271
68 changed files with 706 additions and 1863 deletions

View file

@ -18,22 +18,20 @@ def MediaPlayerGUI():
# A text element that will be changed to display messages in the GUI
# Open a form, note that context manager can't be used generally speaking for async forms
form = sg.FlexForm('Media File Player', auto_size_text=True, default_element_size=(20, 1),
font=("Helvetica", 25), no_titlebar=True)
# define layout of the rows
layout= [[sg.Text('Media File Player',size=(17,1), font=("Helvetica", 25))],
[sg.Text('', size=(15, 2), font=("Helvetica", 14), key='output')],
[sg.ReadFormButton('Restart Song', button_color=(background,background),
[sg.ReadButton('Restart Song', button_color=(background,background),
image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0),
sg.Text(' ' * 2),
sg.ReadFormButton('Pause', button_color=(background,background),
sg.ReadButton('Pause', button_color=(background,background),
image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0),
sg.Text(' ' * 2),
sg.ReadFormButton('Next', button_color=(background,background),
sg.ReadButton('Next', button_color=(background,background),
image_filename=image_next, image_size=(50, 50), image_subsample=2, border_width=0),
sg.Text(' ' * 2),
sg.Text(' ' * 2), sg.SimpleButton('Exit', button_color=(background,background),
sg.Text(' ' * 2), sg.Button('Exit', button_color=(background,background),
image_filename=image_exit, image_size=(50, 50), image_subsample=2, border_width=0)],
[sg.Text('_'*20)],
[sg.Text(' '*30)],
@ -46,20 +44,20 @@ def MediaPlayerGUI():
[sg.Text(' Bass', font=("Helvetica", 15), size=(9, 1)),
sg.Text('Treble', font=("Helvetica", 15), size=(7, 1)),
sg.Text('Volume', font=("Helvetica", 15), size=(7, 1))]
]
# Call the same LayoutAndRead but indicate the form is non-blocking
form.LayoutAndRead(layout, non_blocking=True)
# Open a form, note that context manager can't be used generally speaking for async forms
window = sg.Window('Media File Player', auto_size_text=True, default_element_size=(20, 1),
font=("Helvetica", 25), no_titlebar=True).Layout(layout)
# Our event loop
while(True):
# Read the form (this call will not block)
button, values = form.ReadNonBlocking()
button, values = window.ReadNonBlocking()
if button == 'Exit':
break
# If a button was pressed, display it on the GUI by updating the text element
if button:
form.FindElement('output').Update(button)
window.FindElement('output').Update(button)
MediaPlayerGUI()