FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
PySimpleGUI/DemoPrograms/Demo_Button_Click.py at master · PySimpleGUI/PySimpleGUI · GitHub
PySimpleGUI
/
PySimpleGUI
Public
Notifications
You must be signed in to change notification settings
Fork
1.8k
Star
13.8k
Code
Issues
708
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
PySimpleGUI
/
DemoPrograms
/
Demo_Button_Click.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
33 lines (25 loc) · 1013 Bytes
Breadcrumbs
PySimpleGUI
/
DemoPrograms
/
Demo_Button_Click.py
Copy path
File metadata and controls
33 lines (25 loc) · 1013 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python
import
sys
import
PySimpleGUI
as
sg
"""
Copyright 2018-2026 PySimpleGUI. All rights reserved.
"""
if
not
sys
.
platform
.
startswith
(
'win'
):
sg
.
popup_error
(
'Sorry, you gotta be on Windows'
)
sys
.
exit
()
import
winsound
layout
=
[
[
sg
.
Button
(
'Start'
,
button_color
=
(
'white'
,
'black'
),
key
=
'start'
),
sg
.
Button
(
'Stop'
,
button_color
=
(
'white'
,
'black'
),
key
=
'stop'
),
sg
.
Button
(
'Reset'
,
button_color
=
(
'white'
,
'firebrick3'
),
key
=
'reset'
),
sg
.
Button
(
'Submit'
,
button_color
=
(
'white'
,
'springgreen4'
),
key
=
'submit'
)]
]
window
=
sg
.
Window
(
"Button Click"
,
layout
,
auto_size_buttons
=
False
,
default_button_element_size
=
(
12
,
1
),
use_default_focus
=
False
,
finalize
=
True
)
window
[
'submit'
].
update
(
disabled
=
True
)
recording
=
have_data
=
False
while
True
:
event
,
values
=
window
.
read
(
timeout
=
100
)
if
event
==
sg
.
WINDOW_CLOSED
:
break
winsound
.
PlaySound
(
"ButtonClick.wav"
,
1
)
if
event
!=
sg
.
TIMEOUT_KEY
else
None
window
.
close
()
Back
|
FazBrowse Home
|
New Git URL