Added Sqlite Task Adding
This commit is contained in:
parent
d16655d51b
commit
aa031c130e
2 changed files with 8 additions and 1 deletions
9
main.py
9
main.py
|
@ -7,6 +7,10 @@ con = sqlite3.connect("todo.db")
|
|||
cur = con.cursor()
|
||||
|
||||
|
||||
def get_time():
|
||||
return (datetime.now() - datetime(1970, 1, 1)).total_seconds() + time.timezone # timezone so we get utc time!
|
||||
|
||||
|
||||
def add_item_dialog():
|
||||
input_field = tk.Tk()
|
||||
input_field.title("Add Item")
|
||||
|
@ -34,6 +38,9 @@ def add_item(entry, input_field):
|
|||
print("a")
|
||||
if item:
|
||||
listbox.insert(tk.END, item)
|
||||
cur.execute("INSERT INTO todo(\"ID\",\"TODO\",\"CREATION_DATE\",\"DUE_DATE\",\"PRIO\",\"IMP\") VALUES (NULL, "
|
||||
"'%s', '%s','%s', '%s', '%s' )" % (item, get_time(), get_time(), 100, 0))
|
||||
con.commit()
|
||||
input_field.destroy()
|
||||
|
||||
|
||||
|
@ -45,7 +52,7 @@ def remove_item():
|
|||
|
||||
def update_list():
|
||||
listbox.delete(0, listbox.size()) # clear listbox
|
||||
cur_time = (datetime.now() - datetime(1970, 1, 1)).total_seconds() + time.timezone # timezone so we get utc time!
|
||||
cur_time = get_time()
|
||||
|
||||
total_time = []
|
||||
remaining_time = []
|
||||
|
|
BIN
todo.db
BIN
todo.db
Binary file not shown.
Reference in a new issue