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

@ -3,18 +3,17 @@ import psutil
# ---------------- Create Form ----------------
sg.ChangeLookAndFeel('Black')
form_rows = [[sg.Text('')],
layout = [[sg.Text('')],
[sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='text')],
[sg.Exit(button_color=('white', 'firebrick4'), pad=((15, 0), 0)),
sg.Spin([x + 1 for x in range(10)], 1, key='spin')]]
# Layout the rows of the form and perform a read. Indicate the form is non-blocking!
form = sg.FlexForm('CPU Meter', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True)
form.Layout(form_rows)
window = sg.Window('CPU Meter', no_titlebar=True, auto_size_buttons=False, keep_on_top=True, grab_anywhere=True).Layout(layout)
# ---------------- main loop ----------------
while (True):
# --------- Read and update window --------
button, values = form.ReadNonBlocking()
button, values = window.ReadNonBlocking()
# --------- Do Button Operations --------
if values is None or button == 'Exit':
@ -28,7 +27,7 @@ while (True):
# --------- Display timer in window --------
form.FindElement('text').Update(f'CPU {cpu_percent:02.0f}%')
window.FindElement('text').Update(f'CPU {cpu_percent:02.0f}%')
# Broke out of main loop. Close the window.
form.CloseNonBlockingForm()
window.CloseNonBlocking()