I've been working a lot with text widgets lately, and I have posted several questions here. Again, thanks for all your help.
This time I'd like to post something I found out, so you can help me improve it.
My program consists of two textboxes. The texts inserted in both are expected to have the same amount of paragraphs, if not, users are expected to modify them until this condition is met.
Now, to make things better for them, I decided to place a special character every time they press enter, in other words to have the program mark the end of a paragraph by inserting a particular character.
This is the code:
txt = open(file, "r") #don't forget to replace 'file' with the appropriate name for line in txt.readlines(): t1.insert(END, line.replace("\n","¶\n"))#t1 is the textbox
1. Is there a way to insert this thing = "¶" EVERY time the user presses enter (that would be replacing "\n" with ¶\n, but how do I tell the program to keep reading the widget and replacing?)
2. How do I give that character a red color. I know the fg="red" parameter, but it only works when I create the text widget.
thank you guys.