<div dir="ltr">Thanks for your answer <br><h3 class="gmail-iw"><span name="Maurizio Berti" class="gmail-gD">Maurizio Berti</span></h3></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 21, 2018 at 2:04 PM, Maurizio Berti <span dir="ltr"><<a href="mailto:maurizio.berti@gmail.com" target="_blank">maurizio.berti@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">You could use QTextEdit.setHtml by updating each time the html contents, or, eventually, use a QTextDocument for the QTextEdit and then edit QTextDocument by inserting QTextDocumentFragments.</div><br><div class="gmail_quote"><div><div class="h5"><div dir="ltr">Il giorno mar 21 ago 2018 alle ore 10:51 Maziar Parsijani <<a href="mailto:maziar.parsijani@gmail.com" target="_blank">maziar.parsijani@gmail.com</a>> ha scritto:<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div class="m_-4516671307235011647m_6660038330676751889gmail-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="m_-4516671307235011647m_6660038330676751889gmail-lang-py m_-4516671307235011647m_6660038330676751889gmail-prettyprint m_-4516671307235011647m_6660038330676751889gmail-prettyprinted"><code><span class="m_-4516671307235011647m_6660038330676751889gmail-pln"> self</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">.</span><span class="m_-4516671307235011647m_6660038330676751889gmail-typ">SearchResults</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">.</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">append</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">(</span><span class="m_-4516671307235011647m_6660038330676751889gmail-str">'{0} - {1}'</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">.</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">format</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">(</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">a</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">,</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln"> str</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">(</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">row</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">[</span><span class="m_-4516671307235011647m_6660038330676751889gmail-lit">0</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">])))</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">
self</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">.</span><span class="m_-4516671307235011647m_6660038330676751889gmail-typ">SearchResults</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">.</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">append</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">(</span><span class="m_-4516671307235011647m_6660038330676751889gmail-str">'{0} - {1}'</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">.</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">format</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">(</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">a</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">,</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln"> str</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">(</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">row</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">[</span><span class="m_-4516671307235011647m_6660038330676751889gmail-lit">1</span><span class="m_-4516671307235011647m_6660038330676751889gmail-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="m_-4516671307235011647m_6660038330676751889gmail-lang-py m_-4516671307235011647m_6660038330676751889gmail-prettyprint m_-4516671307235011647m_6660038330676751889gmail-prettyprinted"><code><span class="m_-4516671307235011647m_6660038330676751889gmail-pln"> </span><span class="m_-4516671307235011647m_6660038330676751889gmail-kwd">def</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln"> </span><span class="m_-4516671307235011647m_6660038330676751889gmail-typ">SearchIn</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">(</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">self</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">):</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">
cur </span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">=</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln"> conn</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">.</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">cursor</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">()</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">
conn</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">.</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">text_factory </span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">=</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln"> str
cur</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">.</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">execute</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">(</span><span class="m_-4516671307235011647m_6660038330676751889gmail-str">" SELECT text,text1 FROM Translation WHERE priority = ?"</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">,</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln"> </span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">(</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">self</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">.</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">SINDEX</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">,))</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">
self</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">.</span><span class="m_-4516671307235011647m_6660038330676751889gmail-typ">SearchResults</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">.</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">clear</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">()</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">
a </span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">=</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln"> </span><span class="m_-4516671307235011647m_6660038330676751889gmail-lit">1</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">
</span><span class="m_-4516671307235011647m_6660038330676751889gmail-kwd">for</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln"> row </span><span class="m_-4516671307235011647m_6660038330676751889gmail-kwd">in</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln"> cur</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">:</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">
self</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">.</span><span class="m_-4516671307235011647m_6660038330676751889gmail-typ">SearchResults</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">.</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">append</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">(</span><span class="m_-4516671307235011647m_6660038330676751889gmail-str">'{0} - {1}'</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">.</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">format</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">(</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">a</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">,</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln"> str</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">(</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">row</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">[</span><span class="m_-4516671307235011647m_6660038330676751889gmail-lit">0</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">])))</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">
self</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">.</span><span class="m_-4516671307235011647m_6660038330676751889gmail-typ">SearchResults</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">.</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">append</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">(</span><span class="m_-4516671307235011647m_6660038330676751889gmail-str">'{0} - {1}'</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">.</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">format</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">(</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">a</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">,</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln"> str</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">(</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">row</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">[</span><span class="m_-4516671307235011647m_6660038330676751889gmail-lit">1</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">])))</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln">
a </span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">=</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln"> a </span><span class="m_-4516671307235011647m_6660038330676751889gmail-pun">+</span><span class="m_-4516671307235011647m_6660038330676751889gmail-pln"> </span><span class="m_-4516671307235011647m_6660038330676751889gmail-lit">1</span></code></pre>
</div></div></div></div>
______________________________<wbr>_________________<br>
PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">PyQt@riverbankcomputing.com</a><br>
<a href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" rel="noreferrer" target="_blank">https://www.<wbr>riverbankcomputing.com/<wbr>mailman/listinfo/pyqt</a></blockquote></div><span class="HOEnZb"><font color="#888888"><br clear="all"><div><br></div>-- <br><div dir="ltr" class="m_-4516671307235011647gmail_signature" data-smartmail="gmail_signature">È difficile avere una convinzione precisa quando si parla delle ragioni del cuore. - "Sostiene Pereira", Antonio Tabucchi<br><a href="http://www.jidesk.net" target="_blank">http://www.jidesk.net</a></div>
</font></span></blockquote></div><br></div>