def table_initialization(): db_loc = location_retrieval() conn = create_connection(db_loc) create_sql_table = """CREATE TABLE IF NOT EXISTS tickets ( id integer PRIMARY KEY, timestamp text NOT NULL, category text NOT NULL, task text NOT NULL, more_info text );""" if conn is not None: create_table(conn, create_sql_table) response = option_screen() if response == 1: display_info_category(conn, "DO") elif response == 2: display_info_category(conn, "DEC") elif response == 3: display_info_category(conn, "DLG") elif response == 4: display_info_category(conn, "DEL") elif response == 5: display_info(conn) elif response == 6: addition_ticket(conn) elif response == 7: remove_ticket(conn)
#!/usr/bin/python # -*- coding: utf-8 -*- # Database connection from modules.create_db_components import create_connection """This module is used to contain the function that can remove the ticket from the database.""" # Owned __author__ = "Datta Adithya" __credits__ = ["Datta Adithya"] __license__ = "MIT" __maintainer__ = "Datta Adithya" __email__ = "*****@*****.**" # this function connects and removes the requested ticket def delete_ticket(connect, ticket_id): delete_query = """DELETE FROM tickets WHERE id=?""" cur = connect.cursor() cur.execute(delete_query, (ticket_id, )) connect.commit() print(str(ticket_id) + " has been deleted now.") if __name__ == "__main__": conn = create_connection(r"D:\eisen-tickets\assets\tickets.db") delete_ticket(conn, 1)
) switch_window_button.grid(row=5, column=0) submit_button = tk.Button( self, text="Submit", command=lambda: [ ticket_insertion( self.conn, radio_selection(v), task_entry, more_info_entry ), controller.show_frame(CompletionScreen), ], ) submit_button.grid(row=5, column=1) class CompletionScreen(tk.Frame): def __init__(self, parent, controller, conn): tk.Frame.__init__(self, parent) self.conn = conn tk.Label(self, text="Ticket Added Successfully.").pack(padx=10, pady=10) switch_window_button = ttk.Button( self, text="Return to menu", command=lambda: controller.show_frame(MainPage) ) switch_window_button.pack(side="bottom", fill=tk.X) if __name__ == "__main__": db_conn = location_gui_retrieval() test_window = windows(create_connection(db_conn)) test_window.mainloop()