I've been trying to work around this problem whole previous day. And almost succeeded. But still, I didn't get a clear answer about this - why the next code doesn't work?
import sqlite3
from tkinter import *
from tkinter import ttk
root = Tk()
text = Text(root)
text.pack()
con = sqlite3.connect(':memory:')
c = con.cursor()
c.execute("CREATE TABLE t1 (name)")
c.execute("INSERT INTO t1 VALUES (?)", ('TEST',))
con.commit()
c.execute("SELECT * FROM t1")
text_ = c.fetchall()
text.insert(INSERT, text_)
text.tag_add('one', '1.0', '1.3')
text.tag_config('one', background='blue')
text_get = text.get('1.0', 'end')
c.execute("UPDATE t1 SET name=?", (text_get,))
con.commit()
text.insert(INSERT, '\n')
c.execute("SELECT * FROM t1")
text_ = c.fetchall()
text.insert(INSERT, text_)
root.mainloop()
The result is next: TEXT before saving into db - has a background colour TEXT after updating into db and retrieving it back - doesn't. Is there any way to make it work?