I have written a function like this:
def alignRight(canvas,project):
curPos = text.index(INSERT)
startPos = text.index("%s.0" % (curPos[0]))
endPos = text.index("%s.end" % (curPos[0]))
text.tag_configure("right", justify='right')
text.tag_add("right", startPos, endPos)
project.file = text.get(1.0,'end-1c')
This is working fine. But when I try to save project.file into a .txt file. It loses the align-to-right style that I gave to it. (text is a Text widget)
Is there a way to work around this issue? Thank you!
Also, if it is about .txt files that they cannot inherent the styles, is it possible to save content in a text widget into a .docx file? Or is that something really difficult to do?