On Aug 11, 7:59 pm, [EMAIL PROTECTED] wrote: > On Aug 11, 3:31 am, Bjoern Schliessmann <usenet- > > > > [EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] wrote: > > > On a related topic, it seems like it would be nice to do *all* > > > drawing in > > > response topaintevents. When I get aneventfrom the timer, I > > > would just tell wx that part of the window needs redrawing, and > > > depend on it to give me apainteven when nothing of higher > > > priority needs to be done. > > > One nice strategy from an example in "wxPython in Action" is the > > following: > > > * the frame has Draw methods that draw into a BufferedDC, which is > > chained to a bitmap member > > > * inside thepaintmethod, the bitmap member is drawn to screen > > Okay, but how do I tell wx that it needs to send me a paint event?
Try this: -------------- import wx class MyFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, -1, "My Window") panel = wx.Panel(self, -1) self.text = wx.StaticText(panel, -1, "hello", pos=(40, 40) ) self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.on_timer_event) self.timer.Start(milliseconds=1000, oneShot=False) self.Bind(wx.EVT_PAINT, self.on_paint) def on_timer_event(self, event): self.GetEventHandler().ProcessEvent(wx.PaintEvent()) def on_paint(self, event): print "execution entered on_paint" app = wx.App(redirect=False) win = MyFrame() win.Show() app.MainLoop() ------------ I'm not sure why the call should be self.GetEventHandler().ProcessEvent() instead of just self.ProcessEvent(). -- http://mail.python.org/mailman/listinfo/python-list