From 5f15de7ab92b01d5ef0bd54f074f400e6eefa361 Mon Sep 17 00:00:00 2001 From: julian Date: Sun, 24 Mar 2024 12:10:21 +0100 Subject: [PATCH] relatively compute textbox_heigth when applicable // added TODO for scrollbar in textbox // change message in logfile when save&quit button is pressed --- journal.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/journal.py b/journal.py index 44b8485..f6113b8 100755 --- a/journal.py +++ b/journal.py @@ -70,9 +70,16 @@ name_entry.focus() # # textbox +# TODO: textbox need a scrollbar when applicable +# standard height of the textbox is 40 unless the screen provides more space in which case we will compute +# the textbox_heigth reasonably and relatively to the screensize +textbox_height: int = 40 +if height > 1080: + textbox_height = height - 1400 + message_label = tk.Label(journal, text = "Deine Nachricht:") message_label.grid(column = 0, row = 1, sticky = 'w', padx = 5) -message_text = tk.Text(journal, height = height-1400) +message_text = tk.Text(journal, height = textbox_height) message_text.grid(column = 0, row = 2, padx = 5) def send_button_clicked(): @@ -86,6 +93,7 @@ def send_button_clicked(): def save_and_quit_button_clicked(): with open(journal_filename_path, "a") as journal_of_the_day: + journal_of_the_day.write("Speichern und Beenden von: " + name.get() + " um " + datetime.now().strftime("%Y-%m-%d %H:%M:%S") + "\n") 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")