<div dir="ltr"><div class="gmail-post-text">

<p>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: </p>

<pre class="gmail-lang-py gmail-prettyprint gmail-prettyprinted"><code><span class="gmail-pln">        self</span><span class="gmail-pun">.</span><span class="gmail-typ">SearchResults</span><span class="gmail-pun">.</span><span class="gmail-pln">append</span><span class="gmail-pun">(</span><span class="gmail-str">'{0} - {1}'</span><span class="gmail-pun">.</span><span class="gmail-pln">format</span><span class="gmail-pun">(</span><span class="gmail-pln">a</span><span class="gmail-pun">,</span><span class="gmail-pln"> str</span><span class="gmail-pun">(</span><span class="gmail-pln">row</span><span class="gmail-pun">[</span><span class="gmail-lit">0</span><span class="gmail-pun">])))</span><span class="gmail-pln">
        self</span><span class="gmail-pun">.</span><span class="gmail-typ">SearchResults</span><span class="gmail-pun">.</span><span class="gmail-pln">append</span><span class="gmail-pun">(</span><span class="gmail-str">'{0} - {1}'</span><span class="gmail-pun">.</span><span class="gmail-pln">format</span><span class="gmail-pun">(</span><span class="gmail-pln">a</span><span class="gmail-pun">,</span><span class="gmail-pln"> str</span><span class="gmail-pun">(</span><span class="gmail-pln">row</span><span class="gmail-pun">[</span><span class="gmail-lit">1</span><span class="gmail-pun">])))</span></code></pre>

<p>These 2lines retrieve text from database I want them to be different from  each other by font and color.</p>

<pre class="gmail-lang-py gmail-prettyprint gmail-prettyprinted"><code><span class="gmail-pln">  </span><span class="gmail-kwd">def</span><span class="gmail-pln"> </span><span class="gmail-typ">SearchIn</span><span class="gmail-pun">(</span><span class="gmail-pln">self</span><span class="gmail-pun">):</span><span class="gmail-pln">        
        cur </span><span class="gmail-pun">=</span><span class="gmail-pln"> conn</span><span class="gmail-pun">.</span><span class="gmail-pln">cursor</span><span class="gmail-pun">()</span><span class="gmail-pln">
        conn</span><span class="gmail-pun">.</span><span class="gmail-pln">text_factory </span><span class="gmail-pun">=</span><span class="gmail-pln"> str
        cur</span><span class="gmail-pun">.</span><span class="gmail-pln">execute</span><span class="gmail-pun">(</span><span class="gmail-str">" SELECT text,text1 FROM Translation WHERE priority = ?"</span><span class="gmail-pun">,</span><span class="gmail-pln"> </span><span class="gmail-pun">(</span><span class="gmail-pln">self</span><span class="gmail-pun">.</span><span class="gmail-pln">SINDEX</span><span class="gmail-pun">,))</span><span class="gmail-pln">
        self</span><span class="gmail-pun">.</span><span class="gmail-typ">SearchResults</span><span class="gmail-pun">.</span><span class="gmail-pln">clear</span><span class="gmail-pun">()</span><span class="gmail-pln">
        a </span><span class="gmail-pun">=</span><span class="gmail-pln"> </span><span class="gmail-lit">1</span><span class="gmail-pln">
        </span><span class="gmail-kwd">for</span><span class="gmail-pln"> row </span><span class="gmail-kwd">in</span><span class="gmail-pln"> cur</span><span class="gmail-pun">:</span><span class="gmail-pln">
            self</span><span class="gmail-pun">.</span><span class="gmail-typ">SearchResults</span><span class="gmail-pun">.</span><span class="gmail-pln">append</span><span class="gmail-pun">(</span><span class="gmail-str">'{0} - {1}'</span><span class="gmail-pun">.</span><span class="gmail-pln">format</span><span class="gmail-pun">(</span><span class="gmail-pln">a</span><span class="gmail-pun">,</span><span class="gmail-pln"> str</span><span class="gmail-pun">(</span><span class="gmail-pln">row</span><span class="gmail-pun">[</span><span class="gmail-lit">0</span><span class="gmail-pun">])))</span><span class="gmail-pln">
            self</span><span class="gmail-pun">.</span><span class="gmail-typ">SearchResults</span><span class="gmail-pun">.</span><span class="gmail-pln">append</span><span class="gmail-pun">(</span><span class="gmail-str">'{0} - {1}'</span><span class="gmail-pun">.</span><span class="gmail-pln">format</span><span class="gmail-pun">(</span><span class="gmail-pln">a</span><span class="gmail-pun">,</span><span class="gmail-pln"> str</span><span class="gmail-pun">(</span><span class="gmail-pln">row</span><span class="gmail-pun">[</span><span class="gmail-lit">1</span><span class="gmail-pun">])))</span><span class="gmail-pln">

            a </span><span class="gmail-pun">=</span><span class="gmail-pln"> a </span><span class="gmail-pun">+</span><span class="gmail-pln"> </span><span class="gmail-lit">1</span></code></pre>
    </div></div>