[PyQt] Access to lines of text on textEdit.

Algis Kabaila akabaila at pcug.org.au
Tue Sep 14 02:01:57 BST 2010


On Tuesday 14 September 2010 10:09:10 Hans-Peter Jansen wrote:
> On Tuesday 14 September 2010, 01:54:01 Algis Kabaila wrote:
> > Is it possible to access lines of text in a textEdit?  If so how can I
> > find information about it?
> 
> Depending on document type, try this:
> 
> 	document().findBlockByLineNumber(lineNumber).text()
> 
> Pete
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Thank you, Pete.  It looks just what I want.  The document is data for a 
engineering structural analysis program (usually plain ascii, though in future 
it might be unicode).  The line of code that you gave, looks just what I am 
looking for.  It is a shame I do not understand how document() relates to 
textEdit widget - is it meant to be an instance of textEdit?

I guess I should try it out on the assumption that there is a code line 
someting like 

document = self.textEdit ?

Thank you again - very kind of you to reply and do it so promptly.

Al.

-- 
OldAl
akabaila at pcug.org.au


More information about the PyQt mailing list