2018-09-27 20:24:09 +00:00
|
|
|
#!/usr/bin/env python
|
2018-09-24 22:01:00 +00:00
|
|
|
import sys
|
2018-09-28 18:57:37 +00:00
|
|
|
if sys.version_info[0] >= 3:
|
2018-09-27 20:24:09 +00:00
|
|
|
import PySimpleGUI as sg
|
2018-09-28 18:57:37 +00:00
|
|
|
else:
|
|
|
|
import PySimpleGUI27 as sg
|
2018-09-27 20:24:09 +00:00
|
|
|
|
2018-10-21 17:18:05 +00:00
|
|
|
if not sys.platform.startswith('win'):
|
|
|
|
sg.PopupError('Sorry, you gotta be on Windows')
|
|
|
|
sys.exit()
|
2018-09-27 20:24:09 +00:00
|
|
|
import winsound
|
|
|
|
|
2018-09-14 16:17:19 +00:00
|
|
|
|
2019-09-20 20:59:15 +00:00
|
|
|
# sg.ChangeLookAndFeel('Dark')
|
|
|
|
# sg.SetOptions(element_padding=(0,0))
|
2018-09-14 16:17:19 +00:00
|
|
|
|
|
|
|
layout = [
|
2019-09-20 20:59:15 +00:00
|
|
|
[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')]
|
2018-09-14 16:17:19 +00:00
|
|
|
]
|
|
|
|
|
2018-09-24 22:01:00 +00:00
|
|
|
window = sg.Window("Button Click", default_element_size=(12,1), text_justification='r', auto_size_text=False, auto_size_buttons=False, default_button_element_size=(12,1), use_default_focus=False).Layout(layout).Finalize()
|
2018-09-14 16:17:19 +00:00
|
|
|
|
2018-09-24 22:01:00 +00:00
|
|
|
window.FindElement('submit').Update(disabled=True)
|
2018-09-14 16:17:19 +00:00
|
|
|
|
|
|
|
recording = have_data = False
|
|
|
|
while True:
|
2019-09-20 20:59:15 +00:00
|
|
|
event, values = window.Read(timeout=100)
|
2018-10-15 20:07:23 +00:00
|
|
|
if event is None:
|
2018-09-24 22:01:00 +00:00
|
|
|
sys.exit(69)
|
2019-09-20 20:59:15 +00:00
|
|
|
winsound.PlaySound("ButtonClick.wav", 1) if event != sg.TIMEOUT_KEY else None
|