using wxPython events inside a loop

Diez B. Roggisch deets at nospam.web.de
Wed May 17 10:22:17 EDT 2006


Mr BigSmoke wrote:

> I'm writting an applicatio that that does something like this:
> 
> class batchSpy(wx.Frame):
> 
> def __init__(self, parent):
> 
> wx.Frame.__init__( self, None, -1, "Batch Spy", pos = (0,0),
> size = mySize)
> .... do layout ...
> 
>                 self.searchAlarms()
> 
>          def searchAlarms(self):
>                  for alm in self.alarms: # self.alarms is a list of
> strings
>                         self.almBox.WriteText(alm) #Alm box is a
> wx.TextCtrl widget...
>                         self.Refresh()
> 
> 
> 
> I Know that writing like this my wxFrame just freeze. I've tried usind
> wxTimer event but it doesn't help... Any hint?

Use a thread if possible, or invoke the wx-event-loop periodically. No idea
how to do that in wx though - but google should help.

Diez



More information about the Python-list mailing list