premrg
This commit is contained in:
parent
caf4634724
commit
1ee3056b5a
@ -5,5 +5,6 @@ def hoursSpent(day_start, day_end, break_start, break_end):
|
|||||||
pause = break_end - break_start
|
pause = break_end - break_start
|
||||||
print("pause", pause)
|
print("pause", pause)
|
||||||
duration_without_pause = duration_whole - pause
|
duration_without_pause = duration_whole - pause
|
||||||
|
print("duration_without_pause", duration_without_pause)
|
||||||
|
|
||||||
return duration_without_pause
|
return duration_without_pause
|
||||||
|
13
day.py
13
day.py
@ -16,7 +16,6 @@ class Day:
|
|||||||
|
|
||||||
def beginDay(self):
|
def beginDay(self):
|
||||||
self.begin = datetime.now()
|
self.begin = datetime.now()
|
||||||
print(self.begin)
|
|
||||||
|
|
||||||
def make_break(self):
|
def make_break(self):
|
||||||
self.begin_break = datetime.now()
|
self.begin_break = datetime.now()
|
||||||
@ -29,13 +28,5 @@ class Day:
|
|||||||
self.duration = hoursSpent(
|
self.duration = hoursSpent(
|
||||||
self.begin, self.end, self.begin_break, self.end_break)
|
self.begin, self.end, self.begin_break, self.end_break)
|
||||||
|
|
||||||
|
def get_begin(self):
|
||||||
first_day = Day()
|
return self.begin
|
||||||
first_day.beginDay()
|
|
||||||
sleep(1)
|
|
||||||
first_day.make_break()
|
|
||||||
sleep(2)
|
|
||||||
first_day.go_on()
|
|
||||||
sleep(10)
|
|
||||||
first_day.endDay()
|
|
||||||
print("worked", first_day.duration)
|
|
||||||
|
52
ui.py
52
ui.py
@ -1 +1,53 @@
|
|||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
|
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(
|
||||||
|
self, text="begin day", command=self.bd)
|
||||||
|
self.begin_day.pack(side="left")
|
||||||
|
|
||||||
|
self.end_day = tk.Button(self, text="end day", command=self.ed)
|
||||||
|
self.end_day.pack(side="right")
|
||||||
|
|
||||||
|
self.begin_pause = tk.Button(self, text="begin pause", command=self.mb)
|
||||||
|
self.begin_pause.pack(side="left")
|
||||||
|
|
||||||
|
self.end_pause = tk.Button(self, text="end pause", command=self.go)
|
||||||
|
self.end_pause.pack(side="right")
|
||||||
|
|
||||||
|
def bd(self):
|
||||||
|
self.day.beginDay()
|
||||||
|
self.hi_there["text"] = "Started day"
|
||||||
|
|
||||||
|
def ed(self):
|
||||||
|
self.day.endDay()
|
||||||
|
self.hi_there["text"] = "Good Bye"
|
||||||
|
|
||||||
|
def mb(self):
|
||||||
|
self.day.make_break()
|
||||||
|
self.hi_there["text"] = "Have a nice lunch"
|
||||||
|
|
||||||
|
def go(self):
|
||||||
|
self.day.go_on()
|
||||||
|
self.hi_there["text"] = "Welcome back"
|
||||||
|
|
||||||
|
|
||||||
|
root = tk.Tk()
|
||||||
|
app = Application(master=root)
|
||||||
|
app.mainloop()
|
||||||
|
Loading…
Reference in New Issue
Block a user