Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e6949d6

Browse files
Update Persistant_Timer_Dialog.py
Comments Added/Updated.
1 parent 30a12bc commit e6949d6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

‎Persistant_Timer_Dialog.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,35 @@
99
window = sg.Window('Timer', layout, size=(300, 120), modal=True)
1010

1111
while True:
12+
13+
# For more details on non-blobking window events and the usage of 'timeout' parameter
14+
# read @ https://github.com/PySimpleGUI/PySimpleGUI/issues/520
15+
# Read with a timeout is a very good thing for your GUIs to use in a read non-blocking situation,
16+
# if you can use them. If your device can wait for a little while, then use this kind of read.
17+
# The longer you're able to add to the timeout value, the less CPU time you'll be taking).
18+
# window.read(timeout=10) : This program will quickly test for user input, then deal with the hardware.
19+
# Then it'll sleep for 10ms, while your gui is non-responsive, then it'll check in with your GUI again.
1220
event, values = window.read(timeout=10)
1321

22+
# Close window if exit.\/close is clicked.
1423
if event == sg.WINDOW_CLOSED or event == 'Exit':
1524
break
1625

1726
current_time = datetime.now()
1827
current_time = current_time.strftime("%H:%M:%S")
1928
window['text'].update(current_time)
2029

30+
# Pause the timer.
2131
if event == 'Pause':
2232
timer_paused = True
2333

2434
if timer_paused == True:
2535
window['text'].update('Timer Paused')
2636

37+
# Resume the timer.
2738
if event == 'Resume':
2839
timer_paused = False
2940
window['text'].update(current_time)
41+
3042
# Finish up by removing from the screen
3143
window.close()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /