Fixed import as g instead of sg bug, made some demos borderless, used form.FindElement where possible, fixed PopupGetFile and PopupGetFolder no_window option

This commit is contained in:
MikeTheWatchGuy 2018-09-06 16:20:37 -04:00
parent be6ee091b1
commit b471b5dd05
17 changed files with 153 additions and 147 deletions

View file

@ -8,10 +8,9 @@ def StatusOutputExample():
# Make a form, but don't use context manager
form = sg.FlexForm('Running Timer', auto_size_text=True)
# Create a text element that will be updated with status information on the GUI itself
output_element = sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center')
# Create the rows
form_rows = [[sg.Text('Non-blocking GUI with updates')],
[output_element],
[sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='output')],
[sg.ReadFormButton('LED On'), sg.ReadFormButton('LED Off'), sg.ReadFormButton('Quit')]]
# Layout the rows of the form and perform a read. Indicate the form is non-blocking!
form.LayoutAndRead(form_rows, non_blocking=True)
@ -25,7 +24,7 @@ def StatusOutputExample():
i=0
while (True):
# This is the code that reads and updates your window
output_element.Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100))
form.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100))
button, values = form.ReadNonBlocking()
if button == 'Quit' or values is None:
break