mit lambda im button command wird die funktion erst bei klick ausgeführt

This commit is contained in:
julian 2024-01-20 00:11:16 +01:00
parent a2cb24c6ee
commit 4266bc27ab

View File

@ -49,9 +49,9 @@ message_text.pack()
def send_button_clicked(name, message):
with open(journal_filename_path, "a") as journal_of_the_day:
journal_of_the_day.write(name.get())
journal_of_the_day.write(message.get())
journal_of_the_day.write("-----------------")
journal_of_the_day.write(name.get() + "\n")
journal_of_the_day.write(message.get() + "\n")
journal_of_the_day.write("-----------------\n")
showinfo(title="Information", message="Deine Nachricht wurde gespeichert")
# Send Button
@ -59,7 +59,7 @@ button_send = ttk.Button(
journal,
text="Abschicken",
#command=lambda: showinfo(title="Information", message="Deine Nachricht wurde gespeichert")
command=send_button_clicked(name, message)
command=lambda: send_button_clicked(name, message)
)
button_send.pack()