我不希望将时间记录在输入框和数据库中。我是 PySimpleGUI 的新手,这是我实际使用它的第一个应用程序。
import PySimpleGUI as sg
import datetime
main_name_list = ['Joe',
'Billy',
'Jerry',
'Tommy',
'Bobby',
'Oscar']
main_reason_list = ['Vacation',
'Training',
'Work Travel',
'FMLA',
'Development',
'Other']
name = main_name_list
reason = main_reason_list
# Stuff inside window
layout = [
[sg.Text('Scheduler')],
[sg.Combo(name, size=(30,4), enable_events=True)],
[sg.Combo(reason, size=(30,4), enable_events=True)],
[sg.T('Start Date')],
[sg.In('', size=(20,1), key='input1')],
[sg.CalendarButton('Choose Start Date', target='input1', key='date1')],
[sg.T('End Date')],
[sg.In('', size=(20,1), key='input2')],
[sg.CalendarButton('Choose End Date', target='input2', key='date2')],
[sg.Button('Submit'), sg.Button('Exit')]]
# create the window
window = sg.Window('Scheduler',grab_anywhere=False).Layout(layout)
# event loop to process events and get the values of inputs
while True:
event, values = window.Read()
print(event, values)
if event in (None, 'Exit'):
break
window.Close()
我继续获取与日期相关的时间。