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 4dc3445

Browse files
Timer dialog demo dialog
1 parent 56ef1c8 commit 4dc3445

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

‎One_Shot_Window.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# No validation is added at this point as this is purely to
2626
# introduce the GUI concepts.
2727
if event == 'OK':
28-
sg.Popup('Login Result', 'SUCCESS!', modal=True)
28+
sg.Popup('SUCCESS! (This is to ensure that the message is long enough for the popup title to be visible)', title='Login Result', modal=True)
2929

3030
# Finish up by removing from the screen
3131
window.close()

‎Persistant_Timer_Dialog.py‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import PySimpleGUI as sg
2+
from datetime import datetime
3+
4+
timer_paused = False
5+
layout = [[sg.Text('')],
6+
[sg.Text(size=(16,2),key='text')],
7+
[sg.Button('Pause',key='Pause'),sg.Button('Resume',key='Resume'), sg.Exit(key='Exit')]]
8+
9+
window = sg.Window('Timer', layout)
10+
11+
while True:
12+
event, values = window.read(timeout=10)
13+
14+
if event == sg.WINDOW_CLOSED or event == 'Exit':
15+
break
16+
17+
current_time = datetime.now()
18+
current_time = current_time.strftime("%H:%M:%S")
19+
window['text'].update(current_time)
20+
21+
if event == 'Pause':
22+
timer_paused = True
23+
24+
if timer_paused == True:
25+
window['text'].update('Timer Paused')
26+
27+
# Finish up by removing from the screen
28+
window.close()

0 commit comments

Comments
(0)

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