I'm trying to print the results of this SQLite query to check whether it has stored the data within the database. At the moment it just prints None. Is there a way to open the database in a program like Microsoft Word or LibreOffice. Just to see whether it has saved the content into the database.
import tkinter as tk
import sqlite3 as lite
import sysclass GUI(tk.Frame):def __init__(self, master=None, **kwargs):tk.Frame.__init__(self, master, **kwargs)self.var = tk.StringVar()entry = tk.Entry(self, textvariable=self.var)entry.pack()btn = tk.Button(self, text='read', command=self.read_entry)btn.pack()btn = tk.Button(self, text='write', command=self.write_entry)btn.pack()def read_entry(self):#print(self.var.get())def write_entry(self):self.var.set(self.var.get())con = lite.connect('RandomThings.db')cur = con.cursor()cur.execute("CREATE TABLE jetfighter(Name TEXT)")cur.execute("INSERT INTO jetfighter VALUES (?)", (self.var.get(),))#con.commit()print (cur.fetchone())cur.close()def main():root = tk.Tk()root.geometry('200x200')win = GUI(root)win.pack()root.mainloop()if __name__ == '__main__':main()
Thank you for helping me with my problem.