[PyQt] [pyqt]Insert text from sqlite to qtextedit with diffrent	fonts and colors
    Maziar Parsijani 
    maziar.parsijani at gmail.com
       
    Tue Aug 21 09:51:01 BST 2018
    
    
  
In this code self.SearchResults = QtWidgets.QTextEdit(self) and it retrieve
some text from sqlite3.db Now I need to change font and color for:
        self.SearchResults.append('{0} - {1}'.format(a, str(row[0])))
        self.SearchResults.append('{0} - {1}'.format(a, str(row[1])))
These 2lines retrieve text from database I want them to be different from
each other by font and color.
  def SearchIn(self):
        cur = conn.cursor()
        conn.text_factory = str
        cur.execute(" SELECT text,text1 FROM Translation WHERE
priority = ?", (self.SINDEX,))
        self.SearchResults.clear()
        a = 1
        for row in cur:
            self.SearchResults.append('{0} - {1}'.format(a, str(row[0])))
            self.SearchResults.append('{0} - {1}'.format(a, str(row[1])))
            a = a + 1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20180821/ec3c3edc/attachment.html>
    
    
More information about the PyQt
mailing list