[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] how to get text from QTextEdit document
From: Doug Bell <dougb () bellz ! org>
Date: 2007-04-26 0:56:12
Message-ID: 20070426005612.GA30730 () bellz ! org
[Download RAW message or body]
Paulino wrote:
> Hi,
>
> I want to get the text from a QTextEdit widget into a list, to parse and
> store in a database
>
> I found this solution, but I think there is a cleaner way of doing it
>
>
> def Imprimir(self):
> doc = self.texto.document()
> block = doc.begin()
> lines = [ block.text() ]
> for i in range( 1, doc.blockCount() ):
> block = block.next()
> lines.append( block.text() )
>
> where :
> self.texto = QtGui.QTextEdit(self.widget)
How about:
lines = unicode(self.texto.toPlainText()).split('\n')
Doug.
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic