From 35bf0accdb6fb5a5874231d7ee7a8d762013977e Mon Sep 17 00:00:00 2001 From: marcus Date: Fri, 18 Mar 2022 09:42:57 +0100 Subject: [PATCH] #4 --- main.py | 33 +++-------------------- questions_answer.json | 63 ------------------------------------------- selection_menu.py | 28 +++++++++++++++++++ 3 files changed, 32 insertions(+), 92 deletions(-) delete mode 100644 questions_answer.json create mode 100644 selection_menu.py diff --git a/main.py b/main.py index 06baed7..184c111 100644 --- a/main.py +++ b/main.py @@ -1,38 +1,13 @@ # TODO: Datenbankabfrage -# Auswahlmenü ( Neue Fragen/ Oder Abrfrage) +# Auswahlmenü ( Neue Fragen/ Oder Abfrage) # Ein und Ausgabe der Fragen/Antworten +# Datenbanken (CRUD) Tabellen (CRUD) -import config -import database_connection -import database - -cursor = database_connection.db_connection(config.user, config.password, config.host) - - -def menu(): - enable_menu = True - selection = {1: 'Datenbank erstellen', 2: 'Datenbank löschen', 3: 'Datenbank umbenennen', 4: 'Datenbank auselsen', - 5: 'Tabelle erstellen'} - # TODO Menü erstellen - - print('Was möchtest du tun?') - while enable_menu: - for key, value in selection.items(): - print(key, value) - selection_number = int(input('Bitte Auswahl treffen')) - - match selection_number: - case 1: - print('#Datenbank erstellen#') # Platzhalter für die Funktion - database_name = input('Wie soll die Datenbank heißen?') - database.create(cursor,database_name) - case 2: - print('Datenbank löschen') # Platzhalter für die Funktion - break +import selection_menu def main(): - menu() + selection_menu.menu() main() diff --git a/questions_answer.json b/questions_answer.json deleted file mode 100644 index 4f092a5..0000000 --- a/questions_answer.json +++ /dev/null @@ -1,63 +0,0 @@ -[ - { - "#1": { - "question": " ", - "answer": " " - } - }, - { - "#2": { - "question": " ", - "answer": " " - } - }, - { - "#3": { - "question": " ", - "answer": " " - } - }, - { - "#4": { - "question": " ", - "answer": " " - } - }, - { - "#5": { - "question": " ", - "answer": " " - } - }, - { - "#6": { - "question": " ", - "answer": " " - } - }, - { - "#7": { - "question": " ", - "answer": " " - } - }, - { - "#8": { - "question": " ", - "answer": " " - } - }, - { - "#9": { - "question": " ", - "answer": " " - } - }, - { - "#10": { - "question": " ", - "answer": " " - } - } - -] \ No newline at end of file diff --git a/selection_menu.py b/selection_menu.py new file mode 100644 index 0000000..683334d --- /dev/null +++ b/selection_menu.py @@ -0,0 +1,28 @@ +import database +import database_connection +import config + +cursor = database_connection.db_connection(config.user, config.password, config.host) + + +def menu(): + enable_menu = True + selection = {1: 'Datenbank erstellen', 2: 'Datenbank löschen', 3: 'Datenbank umbenennen', 4: 'Datenbank auselesen', + 5: 'Tabelle erstellen'} + + print('Was möchtest du tun?') + + while enable_menu: + for key, value in selection.items(): + print(key, value) + selection_number = int(input('Bitte Auswahl treffen')) + + match selection_number: + case 1: + print('#Datenbank erstellen#') # Platzhalter für die Funktion + database_name = input('Wie soll die Datenbank heißen?') + database.create(cursor, database_name) + case 2: + # TODO Funktion + print('Datenbank löschen') # Platzhalter für die Funktion + break