<br><br><div class="gmail_quote">On Tue, Feb 3, 2009 at 11:23 AM, Henning Schröder <span dir="ltr"><<a href="mailto:henning.schroeder@gmail.com">henning.schroeder@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d"><br>
</div>I do something like that:<br>
<br>
tc = my_textedit.textCursor()<br>
tc.setPosition(start_pos)<br>
tc.setPosition(end_pos, QTextCursor.KeepAnchor)<br>
sel = QTextEdit.ExtraSelection()<br>
sel.cursor = tc<br>
se.format.setForeground(QColor.red)<br>
sel_list.append(sel) # keep the references<br>
my_textedit.setExtraSelections(sel_list)<br>
<br>
You can connect cursorPositionChanged() to a method which checks if<br>
the current char is a bracket. Then you create an extra selection.<br>
Either you remove the extra selection from your extra selection list<br>
if the position changed again or you use QTimer.singleShot<br>
<br>
The above code is not tested. If it does not work I can upload my<br>
editor widget code.</blockquote><div><br>Please do that. I am not having an luck yet.<br><br>Thanks.<br><br>Edward</div></div><br>