Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 how is the new row selected automatically in treeview
#1
firstly, I would like to apologize for my bad English.

I'm new to Python.

how is the new row selected automatically in this code?

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()
Quote
#2
why did you edit out line 9? for row in rows:
that is the code which got the next row, not automatically, but by value of row.

You're changing code while a response is in the works, makes it very difficult
Quote
#3
explain me more , please
Quote
#4
Read this: https://docs.python.org/3/library/tkinter.ttk.html (section on treeview)
Quote

Top Page

Forum Jump:


Users browsing this thread: 1 Guest(s)