Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.23 KB | None | 0 0
  1. def updateTable():
  2.     def updatedb():
  3.  
  4.         conn = sqlite3.connect('keys.db')
  5.         c = conn.cursor()
  6.         record_id = oidEntry.get()
  7.         c.fetchall()
  8.  
  9.         newpass = "".join(updatepassEntry.get())
  10.         c.execute("SELECT * FROM " + showTable + " WHERE oid = " + record_id)
  11.         c.execute("UPDATE " + showTable + """ SET
  12.        file = :file,
  13.        key = :key
  14.        WHERE oid = :oid""",
  15.                   {':key': newpass,
  16.                    ':oid': oidEntry.get()
  17.                    })
  18.  
  19.         conn.commit()
  20.  
  21.         updatewin.destroy()
  22.         return
  23.  
  24.     showTable = "".join(tablelist.get(tablelist.curselection()))
  25.  
  26.     updatewin = Tk()
  27.     updatewin.geometry("500x500")
  28.     oidLabel = Label(updatewin, text="OID")
  29.     oidEntry = Entry(updatewin, width=2)
  30.     oidLabel.grid()
  31.     oidEntry.grid(row=1)
  32.  
  33.     updatepassLabel = Label(updatewin, text="Passphrase")
  34.     updatepassEntry = Entry(updatewin, width=30)
  35.     updatepassLabel.grid(row=4)
  36.     updatepassEntry.grid(row=5)
  37.  
  38.     updatetableinfoButton = Button(updatewin,
  39.                                    text="Submit",
  40.                                    command=updatedb)
  41.     updatetableinfoButton.grid(row=6)
  42.  
  43.     updatewin.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement