]> git.saurik.com Git - wxWidgets.git/blame - utils/wxPython/demo/wxTimer.py
1. Grid cell defaults are now handled by an internal
[wxWidgets.git] / utils / wxPython / demo / wxTimer.py
CommitLineData
cf694132
RD
1
2from wxPython.wx import *
3
4import time
5
6#---------------------------------------------------------------------------
7
8class TestTimer(wxTimer):
9 def __init__(self, log = None):
10 wxTimer.__init__(self)
11 self.log = log
12
13 def Notify(self):
14 wxBell()
15 if self.log:
16 self.log.WriteText('beep!\n')
17
18#---------------------------------------------------------------------------
19
20_timer = TestTimer()
21
22
23class TestTimerWin(wxPanel):
24 def __init__(self, parent, log):
25 _timer.log = log
26 wxPanel.__init__(self, parent, -1)
27
28 wxStaticText(self, -1, "This is a timer example",
29 wxPoint(15, 30))
30
31 wxButton(self, 11101, ' Start ', wxPoint(15, 75), wxDefaultSize)
efc5f224 32 wxButton(self, 11102, ' Stop ', wxPoint(115, 75), wxDefaultSize)
cf694132
RD
33 EVT_BUTTON(self, 11101, self.OnStart)
34 EVT_BUTTON(self, 11102, self.OnStop)
35
36 def OnStart(self, event):
37 _timer.Start(1000)
38
39 def OnStop(self, event):
40 _timer.Stop()
41
42#---------------------------------------------------------------------------
43
44def runTest(frame, nb, log):
45 win = TestTimerWin(nb, log)
46 return win
47
48#---------------------------------------------------------------------------
49
50
51
52
53
54
55
56
57
58
59
60overview = """\
61The wxTimer class allows you to execute code at specified intervals. To use it, derive a new class and override the Notify member to perform the required action. Start with Start, stop with Stop, it's as simple as that.
62
63wxTimer()
64------------------
65
66Constructor.
67"""