66 lines
1.6 KiB
Python
Executable File
66 lines
1.6 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import tkinter as tk
|
|
import os
|
|
from tkinter import ttk
|
|
from tkinter.messagebox import showinfo
|
|
from datetime import datetime
|
|
|
|
YEAR = datetime.strftime("%Y")
|
|
MONTH = datetime.strftime("%m")
|
|
DAY = datetime.strftime("%d")
|
|
journal_filename = "%s-%s-%s-Journal.txt" %(YEAR, MONTH, DAY)
|
|
journal_filename_path = "./%s" % journal_filename
|
|
|
|
#if os.path.exists(journal_filename_path):
|
|
# print('file already exists')
|
|
#else:
|
|
# # create a file
|
|
# with open(journal_filename_path)
|
|
|
|
# configure root window
|
|
journal = tk.Tk()
|
|
# set Window to fullscreen (dependend of the actual screensize)
|
|
width = journal.winfo_screenwidth()
|
|
height = journal.winfo_screenheight()
|
|
journal.geometry("%dx%d" % (width, height))
|
|
journal.title("Ameland Kinderjournal")
|
|
|
|
# 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)
|
|
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)
|
|
message_text = tk.Text(journal, height=50)
|
|
message_text.pack()
|
|
|
|
# Send Button
|
|
button_send = ttk.Button(
|
|
journal,
|
|
text="Abschicken",
|
|
command=lambda: showinfo(title="Information", message="Deine Nachricht wurde gespeichert")
|
|
)
|
|
button_send.pack()
|
|
|
|
# Quit Button
|
|
button_quit = ttk.Button(
|
|
journal,
|
|
text="Speichern und Beenden",
|
|
command=lambda: journal.quit()
|
|
)
|
|
button_quit.pack()
|
|
|
|
journal.mainloop() |