Repository navigation
Expand file tree
/
Copy pathtest.py
More file actions
140 lines (110 loc) · 5.14 KB
/
Copy pathtest.py
File metadata and controls
140 lines (110 loc) · 5.14 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 28 10:25:50 2018
@author: William_Yue91
"""
import wx
import wx.grid
import wx.adv
class countone(wx.Frame):
def __init__(self, parent=None, idnum=-1, UpdateUI=None):
wx.Frame.__init__(self, parent, idnum, title='个人统计', size=(1000, 800), pos=(200, 200))
self.UpdateUI = UpdateUI
self.pnl = wx.Panel(self)
self.InitUI()
def InitUI(self):
logo_title = wx.StaticText(self.pnl, -1, '统计请确认', pos=(180, 220))
logo_title.SetForegroundColour('#0a74f7')
titleFont = wx.Font(15, wx.DEFAULT, wx.NORMAL, wx.BOLD, True)
logo_title.SetFont(titleFont)
font = wx.Font(14, wx.DEFAULT, wx.NORMAL, wx.BOLD, True)
startLabel = wx.StaticText(self.pnl, -1, '起始', pos=(50, 40))
startLabel.SetFont(font)
yearLabel1 = wx.StaticText(self.pnl, -1, '年', pos=(250, 40))
yearLabel1.SetFont(font)
self.yearInput1 = wx.TextCtrl(self.pnl, -1, u'', pos=(190, 40), size=(60, -1))
self.yearInput1.SetForegroundColour('gray')
self.yearInput1.SetFont(font)
monthLabel1 = wx.StaticText(self.pnl, -1, '月', pos=(330, 40))
monthLabel1.SetFont(font)
self.monthInput1 = wx.TextCtrl(self.pnl, -1, u'', pos=(290, 40), size=(40, -1))
self.monthInput1.SetForegroundColour('gray')
self.monthInput1.SetFont(font)
dayLabel1 = wx.StaticText(self.pnl, -1, '日', pos=(410, 40))
dayLabel1.SetFont(font)
self.dayInput1 = wx.TextCtrl(self.pnl, -1, u'', pos=(370, 40), size=(40, -1))
self.dayInput1.SetForegroundColour('gray')
self.dayInput1.SetFont(font)
endLabel = wx.StaticText(self.pnl, -1, '结束', pos=(50, 80))
endLabel.SetFont(font)
yearLabel2 = wx.StaticText(self.pnl, -1, '年', pos=(250, 80))
yearLabel2.SetFont(font)
self.yearInput2 = wx.TextCtrl(self.pnl, -1, u'', pos=(190, 80), size=(60, -1))
self.yearInput2.SetForegroundColour('gray')
self.yearInput2.SetFont(font)
monthLabel2 = wx.StaticText(self.pnl, -1, '月', pos=(330, 80))
monthLabel2.SetFont(font)
self.monthInput2 = wx.TextCtrl(self.pnl, -1, u'', pos=(290, 80), size=(40, -1))
self.monthInput2.SetForegroundColour('gray')
self.monthInput2.SetFont(font)
dayLabel2 = wx.StaticText(self.pnl, -1, '日', pos=(410, 80))
dayLabel2.SetFont(font)
self.dayInput2 = wx.TextCtrl(self.pnl, -1, u'', pos=(370, 80), size=(40, -1))
self.dayInput2.SetForegroundColour('gray')
self.dayInput2.SetFont(font)
self.edtDateb = wx.adv.DatePickerCtrl(self.pnl, id=-1, size=(90, 40), pos=(90, 30),
style=wx.adv.DP_DROPDOWN | wx.adv.DP_SHOWCENTURY)
self.Bind(wx.adv.EVT_DATE_CHANGED, self.OnCalSelChangedb, self.edtDateb)
self.edtDatee = wx.adv.DatePickerCtrl(self.pnl, id=-1, size=(90, 40), pos=(90, 70),
style=wx.adv.DP_DROPDOWN | wx.adv.DP_SHOWCENTURY)
self.Bind(wx.adv.EVT_DATE_CHANGED, self.OnCalSelChangede, self.edtDatee)
# 统计确认
startButton = wx.Button(self.pnl, -1, u'开始', pos=(90, 160), size=(120, 40))
startButton.SetBackgroundColour('white')
startButton.SetForegroundColour('black')
self.Bind(wx.EVT_BUTTON, self.sureEvent, startButton)
# 返回功能界面
returnButton = wx.Button(self.pnl, -1, u'返回', pos=(240, 160), size=(120, 40))
returnButton.SetBackgroundColour('black')
returnButton.SetForegroundColour('#ffffff')
self.Bind(wx.EVT_BUTTON, self.cancleEvent, returnButton)
self.Show()
def OnCalSelChangedb(self, event):
cal = event.GetEventObject()
datestr = cal.GetValue()
beginyear = datestr.year
beginmonth = str(int(datestr.month) + 1)
beginday = datestr.day
self.yearInput1.Clear()
self.monthInput1.Clear()
self.dayInput1.Clear()
self.yearInput1.WriteText(str(beginyear))
self.monthInput1.WriteText(str(beginmonth))
self.dayInput1.WriteText(str(beginday))
def OnCalSelChangede(self, event):
cal = event.GetEventObject()
datestr = cal.GetValue()
endyear = datestr.year
endmonth = str(int(datestr.month) + 1)
endday = datestr.day
self.yearInput2.Clear()
self.monthInput2.Clear()
self.dayInput2.Clear()
self.yearInput2.WriteText(str(endyear))
self.monthInput2.WriteText(str(endmonth))
self.dayInput2.WriteText(str(endday))
def sureEvent(self, event):
yearbegin = self.yearInput1.GetValue()
monthbegin = self.monthInput1.GetValue()
daybegin = self.dayInput1.GetValue()
yearend = self.yearInput2.GetValue()
monthend = self.monthInput2.GetValue()
dayend = self.dayInput2.GetValue()
print("begin:", yearbegin, monthbegin, daybegin)
print("end:", yearend, monthend, dayend)
def cancleEvent(self, event):
self.Destroy()
if __name__ == '__main__':
app = wx.App()
frame = countone()
app.MainLoop()