If you would like to watch you computer count up to one billion seconds
since the epoch here is a little gizmo to help you do it. My kids got a
kick out of it.
--Robin
import time
from wxPython.wx import *
WHEN = 1000000000 # one billion
class MyFrame(wxFrame):
def __init__(self):
wxFrame.__init__(self, None, -1, "time.time()", size=(100, 75))
p = wxPanel(self, -1)
self.st = st = wxStaticText(p, -1, str(WHEN),
style=wxALIGN_CENTRE|wxST_NO_AUTORESIZE)
st.SetFont(wxFont(16, wxSWISS, wxNORMAL, wxBOLD))
st.SetSize(st.GetBestSize())
box = wxBoxSizer(wxHORIZONTAL)
box.Add(st, 1, wxALIGN_CENTER_VERTICAL)
p.SetAutoLayout(true)
p.SetSizer(box)
p.Fit()
self.Fit()
EVT_CLOSE(self, self.OnCloseWindow)
EVT_TIMER(self, -1, self.OnTimeout)
self.timer = wxTimer(self)
self.timer.Start(1000)
self.OnTimeout(None)
def OnCloseWindow(self, evt):
self.timer.Stop()
del self.timer
self.Destroy()
def OnTimeout(self, evt):
t = time.time()
if t >= WHEN:
self.st.SetForegroundColour("RED")
self.st.SetLabel(str(int(t)))
self.st.Refresh()
app = wxPySimpleApp()
frame = MyFrame()
frame.Show(true)
app.MainLoop()