[Python] How to select all the occurrences in QTextBrowser

Discussão em 'Python' iniciado por Stack, Abril 17, 2025.

  1. Stack

    Stack Membro Participativo

    The code creates QTextBrowser window filled with the lines of text. I would like to select all the words matching "Long Line" How to achieve it?

    [​IMG]

    from PyQt4 import QtCore, QtGui
    app = QtGui.QApplication([])

    view = QtGui.QTextBrowser()
    for i in range(25):
    view.append(10*('Long Line of text # %004d '%i) )
    view.setLineWrapMode(0)

    view.find('Long Line')

    view.show()
    app.exec_()

    Continue reading...

Compartilhe esta Página