This commit is contained in:
Philipp 2019-05-30 16:13:36 +02:00
commit bb3b376ed2
3 changed files with 12 additions and 37 deletions

7
serial.py Normal file
View File

@ -0,0 +1,7 @@
'''Serialisation of data'''
import csv
with open('test.csv', newline='') as csvfile:
spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|')
for row in spamreader:
print(', '.join(row))

1
test.csv Normal file
View File

@ -0,0 +1 @@
Peter, Hans, Otto
1 Peter Hans Otto

41
ui.py
View File

@ -1,5 +1,4 @@
import tkinter as tk import tkinter as tk
from day import Day
class Application(tk.Frame): class Application(tk.Frame):
@ -8,51 +7,19 @@ class Application(tk.Frame):
self.master = master self.master = master
self.pack() self.pack()
self.create_widgets() self.create_widgets()
self.day = Day()
def create_widgets(self): def create_widgets(self):
self.hi_there = tk.Button(self) self.hi_there = tk.Button(self)
self.hi_there["text"] = "Hello World\n(click me)"
self.hi_there["command"] = self.say_hi
self.hi_there.pack(side="top") self.hi_there.pack(side="top")
self.quit = tk.Button(self, text="QUIT", fg="red", self.quit = tk.Button(self, text="QUIT", fg="red",
command=self.master.destroy) command=self.master.destroy)
self.quit.pack(side="bottom") self.quit.pack(side="bottom")
self.begin_day = tk.Button( def say_hi(self):
self, text="begin day", command=self.day_begin) print("hi there, everyone!")
self.begin_day.pack(side="left")
self.end_day = tk.Button(self, text="end day", command=self.day_end)
self.end_day.pack(side="right")
self.begin_pause = tk.Button(
self, text="begin pause", command=self.make_brake)
self.begin_pause.pack(side="left")
self.end_pause = tk.Button(
self, text="end pause", command=self.stop_break)
self.end_pause.pack(side="right")
def day_begin(self):
self.day.beginDay()
self.hi_there["text"] = "Started day"
def day_end(self):
if not self.day.is_day_started():
'''change field to: du musst erst day starten'''
return
self.day.endDay()
self.hi_there["text"] = "Good Bye"
self.day = Day()
def make_brake(self):
self.day.make_break()
self.hi_there["text"] = "Have a nice lunch"
def stop_break(self):
self.day.stop_break()
self.hi_there["text"] = "Welcome back"
root = tk.Tk() root = tk.Tk()