From 068b746bc8871b5e2916116282d5d64d34cd99e2 Mon Sep 17 00:00:00 2001 From: julian Date: Mon, 15 Jan 2024 20:21:58 +0100 Subject: [PATCH] =?UTF-8?q?ein=20lambda=20als=20command=20f=C3=BCr=20send?= =?UTF-8?q?=5Fclicked=20erwirkt=20schonmal,=20dass=20die=20Nachricht=20nic?= =?UTF-8?q?ht=20direkt=20zum=20Load=20des=20Skripts=20angezeigt=20wird,=20?= =?UTF-8?q?allerdings=20funktioniert=20"on-click"=20noch=20nicht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- journal.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/journal.py b/journal.py index 355374e..b8e4359 100755 --- a/journal.py +++ b/journal.py @@ -12,21 +12,18 @@ height = journal.winfo_screenheight() journal.geometry("%dx%d" % (width, height)) journal.title("Ameland Kinderjournal") -# store name and message -name = tk.StringVar() -message = tk.StringVar() - def send_clicked(): """ callback when the message has been composed and "Abschicken" has been clicked """ - msg = f'Deine Nachricht wurde gespeichert' - showinfo( - title='Information', - message=msg - ) + msg = f'Deine Nachricht wurde gespeichert', + command = lambda: showinfo(title="Information", message="Deine Nachricht wurde gespeichert") +# store name and message +name = tk.StringVar() +message = tk.StringVar() + # Main Window journal = ttk.Frame(journal) journal.pack() @@ -45,7 +42,7 @@ message_text = tk.Text(journal, height=50) message_text.pack() # Send Button -button = ttk.Button(journal, text="Abschicken", command=send_clicked()) +button = ttk.Button(journal, text="Abschicken", command=send_clicked(), default="disabled") button.pack() -journal.mainloop() +journal.mainloop() \ No newline at end of file