relatively compute textbox_heigth when applicable // added TODO for scrollbar in textbox // change message in logfile when save&quit button is pressed

This commit is contained in:
julian 2024-03-24 12:10:21 +01:00
parent 28c379f5f4
commit 5f15de7ab9

View File

@ -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")