refactoring comments. they are titles for the code below them and the refactor aims to make this clearer

This commit is contained in:
julian 2024-03-23 14:12:25 +01:00
parent 19a0e6000d
commit 5ffc4e647b

View File

@ -13,6 +13,7 @@ MONTH = now.strftime("%m")
DAY = now.strftime("%d")
journal_filename = "%s-%s-%s-Journal.txt" % (YEAR, MONTH, DAY)
#
# determine OS to correctly save journal file and to switch back to one-branch development for convenience
if os.name == 'posix':
journal_filename_path = "./%s" % journal_filename
@ -27,11 +28,9 @@ else:
with open(journal_filename_path, "a"):
pass
# configure root window
journal = tk.Tk()
# label = tk.Label(journal, image=image)
# label.place(x=0, y=0)
#
# set window to fullscreen (dependend of the actual screensize) and fill with a background image
image_location = 'background.jpg'
width = journal.winfo_screenwidth()
@ -41,19 +40,24 @@ journal.title("Ameland Kinderjournal")
img = ImageTk.PhotoImage(Image.open(image_location).resize((width, height), Image.ADAPTIVE))
label = tk.Label(journal, image=img)
#
# Keep a reference in case this code put is in a function.
label.img = img
#
# Place label in center of parent.
label.place(relx=0.5, rely=0.5, anchor='center')
#
# store name and message
name = tk.StringVar()
message = tk.StringVar()
#
# Main Window
journal = ttk.Frame(journal)
journal.pack()
#
# name
name_label = ttk.Label(journal, text = "Dein Name:")
name_label.pack(fill = 'x', expand = True)
@ -61,6 +65,7 @@ name_entry = ttk.Entry(journal, textvariable = name)
name_entry.pack(fill = 'x', expand = True)
name_entry.focus()
#
# textbox
message_label = tk.Label(journal, text = "Deine Nachricht:")
message_label.pack(fill = 'x', expand = True)
@ -84,6 +89,7 @@ def save_and_quit_button_clicked():
journal_of_the_day.write("-----------------\n")
journal.quit()
#
# Send Button
button_send = ttk.Button(
journal,
@ -92,6 +98,7 @@ button_send = ttk.Button(
)
button_send.pack(pady = 15, padx = 15)
#
# Quit Button
button_quit = ttk.Button(
journal,