]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/demo/wxTimer.py
added missing destructor for Darwin/Mac OS X (wxGtk, wxMotif, wxMac)
[wxWidgets.git] / wxPython / demo / wxTimer.py
... / ...
CommitLineData
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)
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
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"""