-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Le Boulanger Yann
Sent: Sunday, March 27, 2005 1:06 PM
To: pygtk-list
Subject: Re: [pygtk] string on new line in a text view


> Saurabh Wagh wrote:
> > Hey there..
> > 
> > Something that might sound very primitive... but can anyone please
> > help me out with this urgently
> > 
> > i am using a text buffer to display contents from a list and use the
> > following lines of code.
> > 
> > result = ["abc", "def", "ghi", "jkl", "mno", "pqr", "stu", "vwx", "yz"]
> > 
> >     for text in result:
> >         textbuffer.insert_at_cursor(text)
> > 
> > All the text appears on a single line in the text view
> > 
> > However i want each string to appear on a seperate line. can any one
> > please help me out with this problem of moving every single string of
> > the list on to a new line ?
> > 
> > Thanking u in anticipation
> > 
> > -- Saurabh
> 
> for text in result:
>      textbuffer.insert_at_cursor(text + '\n')
> 

Or even shorter:

textbuffer.insert_at_cursor('\n'.join(result))

> Yann
> _______________________________________________
> pygtk mailing list   [email protected]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
> 
_______________________________________________
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