[wxPython-users] need help displaying One Word at a time...
Robin Dunn
robin at alldunn.com
Wed Mar 5 15:28:21 PST 2008
Gary Kline wrote:
> On Tue, Mar 04, 2008 at 12:53:19PM -0800, Robin Dunn wrote:
>> Gary Kline wrote:
>>> Hi Guys,
>
> Haven'tt worked with times since my Athena days:)
> Would this quasi pseduo-code be close? or am i still too far off the
> mark? I probably have a lo
Try this:
import wx
class MainPanel(wx.Panel):
def __init__(self, *args, **kw):
wx.Panel.__init__(self, *args, **kw)
def MakeNextWordGenerator():
words = "This is a test".split()
while True:
for word in words:
yield word
self.nextWord = MakeNextWordGenerator()
self.st = wx.StaticText(self, -1, self.nextWord.next(),
pos=(25,25))
self.timer = wx.Timer(self)
self.timer.Start(1000)
self.Bind(wx.EVT_TIMER, self.OnTimer)
def OnTimer(self, evt):
word = self.nextWord.next()
self.st.SetLabel(word)
app = wx.App(redirect=False)
frm = wx.Frame(None, title="timer test")
pnl = MainPanel(frm)
frm.Show()
app.MainLoop()
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list