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:
parent
2a06683383
commit
a1f4c60271
68 changed files with 706 additions and 1863 deletions
|
@ -29,38 +29,32 @@ def MachineLearningGUI():
|
|||
[sg.Frame('Loss Functions', loss_functions, font='Any 12', title_color='red')],
|
||||
[sg.Submit(), sg.Cancel()]]
|
||||
|
||||
|
||||
form = sg.FlexForm('Machine Learning Front End', font=("Helvetica", 12))
|
||||
button, values = form.LayoutAndRead(layout)
|
||||
del(form)
|
||||
window = sg.Window('Machine Learning Front End', font=("Helvetica", 12)).Layout(layout)
|
||||
button, values = window.Read()
|
||||
sg.SetOptions(text_justification='left')
|
||||
|
||||
print(button, values)
|
||||
|
||||
|
||||
def CustomMeter():
|
||||
# create the progress bar element
|
||||
progress_bar = sg.ProgressBar(10000, orientation='h', size=(20,20))
|
||||
# layout the form
|
||||
layout = [[sg.Text('A custom progress meter')],
|
||||
[progress_bar],
|
||||
[sg.ProgressBar(10000, orientation='h', size=(20,20), key='progress')],
|
||||
[sg.Cancel()]]
|
||||
|
||||
# create the form`
|
||||
form = sg.FlexForm('Custom Progress Meter')
|
||||
# display the form as a non-blocking form
|
||||
form.LayoutAndRead(layout, non_blocking=True)
|
||||
window = sg.Window('Custom Progress Meter').Layout(layout)
|
||||
progress_bar = window.FindElement('progress')
|
||||
# loop that would normally do something useful
|
||||
for i in range(10000):
|
||||
# check to see if the cancel button was clicked and exit loop if clicked
|
||||
button, values = form.ReadNonBlocking()
|
||||
button, values = window.ReadNonBlocking()
|
||||
if button == 'Cancel' or values == None:
|
||||
break
|
||||
# update bar with loop value +1 so that bar eventually reaches the maximum
|
||||
progress_bar.UpdateBar(i+1)
|
||||
# done with loop... need to destroy the window as it's still open
|
||||
form.CloseNonBlockingForm()
|
||||
window.CloseNonBlocking()
|
||||
|
||||
if __name__ == '__main__':
|
||||
# CustomMeter()
|
||||
CustomMeter()
|
||||
MachineLearningGUI()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue