how do i manually parse output of .dump() from a text widget that has italic and bold text in it to a different text widget to load it along with its text format.
this is the code if it helps, the text should be saved along with text format but when the file is open the text format is gone:
from tkinter import *
from tkinter import filedialog
root = Tk()
textpad=Text(root, font='Consolas 11')
textpad.pack()
def save():
content=textpad.get(1.0,'end')
filename=filedialog.asksaveasfilename(title='open file',filetypes=(("text","*.txt"),("html",".html"),("all types","*.*")))
openit=open(filename,'w')
openit.write(content)
openit.close()
def opens():
textpad.delete(1.0,'end')
filename=filedialog.askopenfilename(title='open file',filetypes=(("text","*.txt"),("html",".html"),("all types","*.*")))
openit=open(filename,'r')
content=openit.read()
textpad.insert('end',content.strip())
openit.close()
def boldtext():
textpad.selection_get()
textpad.tag_add('bold','sel.first','sel.last')
textpad.tag_config('bold',font='Consolas 11 bold')
savebtn=Button(text='save',command=save)
savebtn.pack()
openbtn=Button(text='open',command=opens)
openbtn.pack()
bold=Button(text='bold',command=boldtext)
bold.pack()
root.mainloop()