]>
git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/demo/wxTimer.py
2 from wxPython
. wx
import *
6 #---------------------------------------------------------------------------
8 class TestTimer ( wxTimer
):
9 def __init__ ( self
, log
= None ):
10 wxTimer
.__ init
__ ( self
)
16 self
. log
. WriteText ( 'beep! \n ' )
18 #---------------------------------------------------------------------------
23 class TestTimerWin ( wxPanel
):
24 def __init__ ( self
, parent
, log
):
26 wxPanel
.__ init
__ ( self
, parent
, - 1 )
28 wxStaticText ( self
, - 1 , "This is a timer example" ,
31 wxButton ( self
, 11101 , ' Start ' , wxPoint ( 15 , 75 ), wxDefaultSize
)
32 wxButton ( self
, 11102 , ' Stop ' , wxPoint ( 77 , 75 ), wxDefaultSize
)
33 EVT_BUTTON ( self
, 11101 , self
. OnStart
)
34 EVT_BUTTON ( self
, 11102 , self
. OnStop
)
36 def OnStart ( self
, event
):
39 def OnStop ( self
, event
):
42 #---------------------------------------------------------------------------
44 def runTest ( frame
, nb
, log
):
45 win
= TestTimerWin ( nb
, log
)
48 #---------------------------------------------------------------------------
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.