> OK, this requires using what should be called "Secret Technique #1 For
> Making Your Application Look Responsive"(tm):

wow...how many secrets you have?? this work really good :)

> (1) Push out the data in line-based chunks. This will tend to look nicer
> in an incrementally updated display, rather than seeing part of a line
> display and then suddenly have some more text whacked onto the end of
> that line. This is particularly relevant since you have turned on wrap
> mode, so you might get some strange re-wrapping effects if you inserted
> arbitrary chunks which could terminate mid-word.

I've choose to display one line a time in the window

                while 1:
                        data_o = child_o.readline()
                        textbuffer.insert(textbuffer.get_end_iter(), data_o)
                        textview.scroll_to_mark(textbuffer.get_insert(), 0)
                        while gtk.events_pending():
                                gtk.mainiteration(gtk.FALSE)

>
> (2) Think about what should be displayed on the screen after each
> update. Do you want to have the beginning of the text displayed and let
> the user scroll down in their leisure (the web browser style of
> behaviour), or do you want to always display the last piece of text you
> inserted (the terminal window style)? Either is possible, you just need
> to set the correct portion to be displayed.

And also I choose to set the cursor position at the end of the output, like if 
it is displayed in a *NIX consolle.

                textview.scroll_to_mark(textbuffer.get_insert(), 0)

>
> Hope this helps a bit. Secret Technique #1 is the solution to so many of
> these questions. :-)

It helps a lot not just a bit, the only problem I have to solve noe is how to 
exit from the loop in the right way, if I place a return at the end of

                                while gtk.events_pending():
                                        gtk.mainiteration(gtk.FALSE)

just one line will be displayed, if I leave the loop open it wont stop so I 
cannot, for example, call the mainquit().
I've read the faq but if the solution is there I haven't understood :p

>
> Cheers,
> Malcolm

Have a nice week-end
Mario aka Liquid

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to