Hi Saeed,<br><br>that works! thank you. =)<br><br>Lucas.<br><br><div class="gmail_quote">On Thu, Aug 27, 2009 at 1:09 PM, saeed <span dir="ltr"><<a href="mailto:saeed.gnu@gmail.com">saeed.gnu@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Write this two line when you want to update GUI, here write it in<br>
function status, or after calling it:<br>
while gtk.events_pending():<br>
gtk.main_iteration_do(False)<br>
<div class="im"><br>
<br>
<br>
def status(self, msg):<br>
self.textbuffer_status.insert_at_cursor('%s \n' % msg)<br>
self.textview_status.scroll_to_mark(self.textbuffer_status.get_insert(),<br>
0)<br>
</div> while gtk.events_pending():<br>
gtk.main_iteration_do(False)<br>
<div><div></div><div class="h5"><br>
<br>
On 8/27/09, Lucas Mocellin <<a href="mailto:lucasmocellin@gmail.com">lucasmocellin@gmail.com</a>> wrote:<br>
> Hi folks,<br>
><br>
> I made a GUI that when someone click on a button, it calls a function and do<br>
> "somethings" and some of them is:<br>
><br>
> self.status('Estudante liberado para fazer a prova!')<br>
> self.status('Conectando ao servidor de Provas, Aguarde um<br>
> momento por favor..')<br>
> for i in range(30):<br>
> if (os.system('ip link show tun0') == 0):<br>
> break<br>
> if (i == 29):<br>
> self.status('Erro na conexao com o servidor de provas,<br>
> tente novamente.')<br>
> return<br>
> time.sleep(2)<br>
> self.status('Conexao realizada com sucesso.')<br>
> self.status('Abrindo Prova Online.')<br>
><br>
> the self.status is a function which I created to show msg in the TextView:<br>
> def status(self, msg):<br>
> self.textbuffer_status.insert_at_cursor('%s \n' % msg)<br>
><br>
> self.textview_status.scroll_to_mark(self.textbuffer_status.get_insert(), 0)<br>
> ------------------<br>
> the problem is, the first 2 messages (self.status(*)) doesn't appear in the<br>
> correct time, there is a great delay for them, you can notice that the "for<br>
> statement" MAY late a minute, and when it happens, the first 2 messages only<br>
> apeear AFTER this minute.. with the other 2 in the end.<br>
><br>
> It looks like a "refresh/flush" problem, I tried "gtk.gdk.flush()", but it<br>
> didn't work out.<br>
><br>
> any ideas?<br>
><br>
> Thanks in advance,<br>
><br>
> Lucas.<br>
> gtk.gdk.flush()<br>
><br>
</div></div></blockquote></div><br>