首先,我要为我的英语不好而道歉。
我是Python的新手。
如何在此代码中自动选择新行?
def add_students():
con = sqlite3.connect("data.db")
cur = con.cursor()
cur.execute("INSERT INTO students VALUES (NULL, ?, ?)", (name_var.get(), class_var.get()))
con.commit()
cur.execute("select * from students ORDER BY class ASC ,name ASC")
rows = cur.fetchall()
if len(rows) != 0:
my_treeview.delete(*my_treeview.get_children())
for row in rows:
my_treeview.insert('', END, values = row)
con.commit()
con.close()