From 681f9b11630b1337652b8ba7dc9990bb631fea84 Mon Sep 17 00:00:00 2001 From: julian Date: Thu, 25 Apr 2024 07:53:28 +0200 Subject: [PATCH] auf 'Soeichern und Beenden' ohne eingetragenen Namen reagieren --- journal.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/journal.py b/journal.py index daf6b07..2386cd5 100755 --- a/journal.py +++ b/journal.py @@ -91,14 +91,15 @@ def send_button_clicked(): name.set("") showinfo(title = "Information", message = "Deine Nachricht wurde gespeichert") -# -# TODO: Checken, on name leer ist und entsprechend im Output reagieren def save_and_quit_button_clicked(): with open(journal_filename_path, "a") as journal_of_the_day: journal_of_the_day.write(name.get() + "\n") journal_of_the_day.write(message_text.get(1.0, "end-1c") + "\n") journal_of_the_day.write("-----------------\n") - journal_of_the_day.write("Speichern und Beenden von: " + name.get() + " um " + datetime.now().strftime("%Y-%m-%d %H:%M:%S") + "\n") + if not name.get(): + journal_of_the_day.write("Speichern und Beenden von: " + "" + " um " + datetime.now().strftime("%Y-%m-%d %H:%M:%S") + "\n") + else: + journal_of_the_day.write("Speichern und Beenden von: " + name.get() + " um " + datetime.now().strftime("%Y-%m-%d %H:%M:%S") + "\n") journal.quit() #