I hope doing good I am facing an issue with changing the color of only searched string from a file in QTextEdit and I have used replace method with "colored" module but I am not getting colored string, in console window I am getting colored string of selected one but in "QTextEdit" I am getting this
before searching I am getting this
Here I need to change the color of only searched word.
Here is my code `
with open(self.new_path, 'r') as f2:
for line in f2:
if re.findall(tex, line):
color = colored(tex, 'blue', attrs=())
line = line.replace(tex, color)
self.w.append(line)
self.sub.setWidget(self.w)
self.sub.setWindowTitle('Sabrefiles'+" "+str(treewid.count))
self.mdiArea.addSubWindow(self.sub)
self.sub.show()
`