2019-05-30 13:35:53 +02:00
|
|
|
import tkinter as tk
|
2019-05-30 15:03:02 +02:00
|
|
|
from day import Day
|
|
|
|
|
|
|
|
|
|
|
|
class Application(tk.Frame):
|
|
|
|
def __init__(self, master=None):
|
|
|
|
super().__init__(master)
|
|
|
|
self.master = master
|
|
|
|
self.pack()
|
|
|
|
self.create_widgets()
|
|
|
|
self.day = Day()
|
|
|
|
|
|
|
|
def create_widgets(self):
|
|
|
|
self.hi_there = tk.Button(self)
|
|
|
|
self.hi_there.pack(side="top")
|
|
|
|
|
|
|
|
self.quit = tk.Button(self, text="QUIT", fg="red",
|
|
|
|
command=self.master.destroy)
|
|
|
|
self.quit.pack(side="bottom")
|
|
|
|
|
|
|
|
self.begin_day = tk.Button(
|
2019-05-30 16:12:51 +02:00
|
|
|
self, text="begin day", command=self.day_begin)
|
2019-05-30 15:03:02 +02:00
|
|
|
self.begin_day.pack(side="left")
|
|
|
|
|
2019-05-30 16:12:51 +02:00
|
|
|
self.end_day = tk.Button(self, text="end day", command=self.day_end)
|
2019-05-30 15:03:02 +02:00
|
|
|
self.end_day.pack(side="right")
|
|
|
|
|
2019-05-30 16:12:51 +02:00
|
|
|
self.begin_pause = tk.Button(
|
|
|
|
self, text="begin pause", command=self.make_brake)
|
2019-05-30 15:03:02 +02:00
|
|
|
self.begin_pause.pack(side="left")
|
|
|
|
|
2019-05-30 16:12:51 +02:00
|
|
|
self.end_pause = tk.Button(
|
|
|
|
self, text="end pause", command=self.stop_break)
|
2019-05-30 15:03:02 +02:00
|
|
|
self.end_pause.pack(side="right")
|
|
|
|
|
2019-05-30 16:12:51 +02:00
|
|
|
def day_begin(self):
|
2019-05-30 15:03:02 +02:00
|
|
|
self.day.beginDay()
|
|
|
|
self.hi_there["text"] = "Started day"
|
|
|
|
|
2019-05-30 16:12:51 +02:00
|
|
|
def day_end(self):
|
|
|
|
if not self.day.is_day_started():
|
|
|
|
'''change field to: du musst erst day starten'''
|
|
|
|
return
|
|
|
|
|
2019-05-30 15:03:02 +02:00
|
|
|
self.day.endDay()
|
|
|
|
self.hi_there["text"] = "Good Bye"
|
2019-05-30 16:12:51 +02:00
|
|
|
self.day = Day()
|
2019-05-30 15:03:02 +02:00
|
|
|
|
2019-05-30 16:12:51 +02:00
|
|
|
def make_brake(self):
|
2019-05-30 15:03:02 +02:00
|
|
|
self.day.make_break()
|
|
|
|
self.hi_there["text"] = "Have a nice lunch"
|
|
|
|
|
2019-05-30 16:12:51 +02:00
|
|
|
def stop_break(self):
|
|
|
|
self.day.stop_break()
|
2019-05-30 15:03:02 +02:00
|
|
|
self.hi_there["text"] = "Welcome back"
|
|
|
|
|
|
|
|
|
|
|
|
root = tk.Tk()
|
|
|
|
app = Application(master=root)
|
|
|
|
app.mainloop()
|