]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/demo/wxTimer.py
added font encoding support
[wxWidgets.git] / utils / wxPython / demo / wxTimer.py
1
2 from wxPython.wx import *
3
4 import time
5
6 #---------------------------------------------------------------------------
7
8 class 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
23 class 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)
32 wxButton(self, 11102, ' Stop ', wxPoint(115, 75), wxDefaultSize)
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
44 def 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
60 overview = """\
61 The 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
63 wxTimer()
64 ------------------
65
66 Constructor.
67 """