[pygtk] Question about "TextView" refresh
Lucas Mocellin
lucasmocellin at gmail.com
Fri Aug 28 20:06:51 WST 2009
Hi Saeed,
that works! thank you. =)
Lucas.
On Thu, Aug 27, 2009 at 1:09 PM, saeed <saeed.gnu at gmail.com> wrote:
> Write this two line when you want to update GUI, here write it in
> function status, or after calling it:
> while gtk.events_pending():
> gtk.main_iteration_do(False)
>
>
>
> def status(self, msg):
> self.textbuffer_status.insert_at_cursor('%s \n' % msg)
>
> self.textview_status.scroll_to_mark(self.textbuffer_status.get_insert(),
> 0)
> while gtk.events_pending():
> gtk.main_iteration_do(False)
>
>
> On 8/27/09, Lucas Mocellin <lucasmocellin at gmail.com> wrote:
> > Hi folks,
> >
> > I made a GUI that when someone click on a button, it calls a function and
> do
> > "somethings" and some of them is:
> >
> > self.status('Estudante liberado para fazer a prova!')
> > self.status('Conectando ao servidor de Provas, Aguarde um
> > momento por favor..')
> > for i in range(30):
> > if (os.system('ip link show tun0') == 0):
> > break
> > if (i == 29):
> > self.status('Erro na conexao com o servidor de
> provas,
> > tente novamente.')
> > return
> > time.sleep(2)
> > self.status('Conexao realizada com sucesso.')
> > self.status('Abrindo Prova Online.')
> >
> > the self.status is a function which I created to show msg in the
> TextView:
> > def status(self, msg):
> > self.textbuffer_status.insert_at_cursor('%s \n' % msg)
> >
> > self.textview_status.scroll_to_mark(self.textbuffer_status.get_insert(),
> 0)
> > ------------------
> > the problem is, the first 2 messages (self.status(*)) doesn't appear in
> the
> > correct time, there is a great delay for them, you can notice that the
> "for
> > statement" MAY late a minute, and when it happens, the first 2 messages
> only
> > apeear AFTER this minute.. with the other 2 in the end.
> >
> > It looks like a "refresh/flush" problem, I tried "gtk.gdk.flush()", but
> it
> > didn't work out.
> >
> > any ideas?
> >
> > Thanks in advance,
> >
> > Lucas.
> > gtk.gdk.flush()
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20090828/095ecc05/attachment-0001.htm
More information about the pygtk
mailing list