wxPython: TextCtrl delayed update when using TE_RICH(2)

jean-michel bain-cornu pythonnews at nospam.jmbc.fr
Sun Feb 4 04:40:44 EST 2007


Hi,
> def Execute(self, evt):
>     print "Start query"
>     time.sleep(5)
> 
> The "Start query" message should show in the *messages* box when I
> press the button. Instead, it shows only after the time.sleep(5)
> delay.
> 
> If I don't use the wx.TE_RICH / wx.TE_RICH2 style on *messages*, the
> text shows before the time.sleep(5)

For this kind of stuff, I'd try to put "self.out.WriteText(string)" in 
some 'Idle' event, which avoid to fall in focus loops or other objects 
events management problems not easy to solve.

Did you try something like that :

def write(self, string):
     self.outBuffer= string
def onIdle(self,event):
     if self.outBuffer != None:
         self.out.WriteText(self.outBuffer)
         self.outBuffer= None



More information about the Python-list mailing list