469,903 Members | 1,664 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,903 developers. It's quick & easy.

using wxPython events inside a loop

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?

TNX

May 17 '06 #1
2 1441
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
May 17 '06 #2
Hello BigSmoke,

You can process one at a time in an "OnIdle" handler, this way you'll
work only when the application is doing nothing.

HTH,
Miki,
http://pythonwise.blogspot.com/

May 18 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by pysim | last post: by
15 posts views Thread by Grant Edwards | last post: by
8 posts views Thread by Erik Johnson | last post: by
9 posts views Thread by perchef | last post: by
1 post views Thread by Benjamin | last post: by
12 posts views Thread by Matt Bitten | last post: by
4 posts views Thread by Jimmy | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.