Moved and reorganized wxPython directories
Now builds into an intermediate wxPython package directory before installing git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7403 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
67
wxPython/demo/wxTimer.py
Normal file
67
wxPython/demo/wxTimer.py
Normal file
@@ -0,0 +1,67 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
import time
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class TestTimer(wxTimer):
|
||||
def __init__(self, log = None):
|
||||
wxTimer.__init__(self)
|
||||
self.log = log
|
||||
|
||||
def Notify(self):
|
||||
wxBell()
|
||||
if self.log:
|
||||
self.log.WriteText('beep!\n')
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
_timer = TestTimer()
|
||||
|
||||
|
||||
class TestTimerWin(wxPanel):
|
||||
def __init__(self, parent, log):
|
||||
_timer.log = log
|
||||
wxPanel.__init__(self, parent, -1)
|
||||
|
||||
wxStaticText(self, -1, "This is a timer example",
|
||||
wxPoint(15, 30))
|
||||
|
||||
wxButton(self, 11101, ' Start ', wxPoint(15, 75), wxDefaultSize)
|
||||
wxButton(self, 11102, ' Stop ', wxPoint(115, 75), wxDefaultSize)
|
||||
EVT_BUTTON(self, 11101, self.OnStart)
|
||||
EVT_BUTTON(self, 11102, self.OnStop)
|
||||
|
||||
def OnStart(self, event):
|
||||
_timer.Start(1000)
|
||||
|
||||
def OnStop(self, event):
|
||||
_timer.Stop()
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = TestTimerWin(nb, log)
|
||||
return win
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
overview = """\
|
||||
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.
|
||||
|
||||
wxTimer()
|
||||
------------------
|
||||
|
||||
Constructor.
|
||||
"""
|
Reference in New Issue
Block a user