-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwxTimeClock.py
More file actions
executable file
·71 lines (57 loc) · 1.55 KB
/
wxTimeClock.py
File metadata and controls
executable file
·71 lines (57 loc) · 1.55 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
import wx
from datetime import datetime
pop_time = 0
pop_last = datetime.now()
oneten_time = 0
oneten_last = None
def work_pop(event):
global pop_last
global pop_time
global oneten_last
global oneten_time
now = datetime.now()
if oneten_last is None:
oneten_last = now
return
else:
oneten_time += (now - oneten_last).seconds
pop_last = now
oneten_last = None
filename2.SetValue(str(oneten_time))
def work_oneten(event):
global pop_last
global pop_time
global oneten_last
global oneten_time
now = datetime.now()
if pop_last is None:
pop_last = now
return
else:
pop_time += (now - pop_last).seconds
oneten_last = now
pop_last = None
filename.SetValue(str(pop_time))
app = wx.App()
win = wx.Frame(None, title="Chess Clock", size=(300,300))
bkg = wx.Panel(win)
popButton = wx.Button(bkg, label="PoP")
popButton.Bind(wx.EVT_BUTTON, work_pop)
onetenButton = wx.Button(bkg, label="1:10")
onetenButton.Bind(wx.EVT_BUTTON, work_oneten)
filename = wx.TextCtrl(bkg)
filename2 = wx.TextCtrl(bkg)
vbox = wx.BoxSizer(wx.VERTICAL)
vbox.Add(filename, proportion=0)
vbox.Add(popButton, proportion=1)
vbox2 = wx.BoxSizer(wx.VERTICAL)
vbox2.Add(filename2, proportion=0)
vbox2.Add(onetenButton, proportion=1)
hbox = wx.BoxSizer()
hbox.Add(vbox, proportion=0)
hbox.Add(vbox2, proportion=1)
#hbox.Add(filename, proportion=1, flag=wx.EXPAND)
#hbox.Add(loadButton, proportion=0, flag=wx.LEFT, border=5)
bkg.SetSizer(hbox)
win.Show()
app.MainLoop()