-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
43 lines (34 loc) · 1.25 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
print("Loading...")
from tkinter import Tk, Canvas
from datetime import date, datetime
from playsound3 import playsound
import threading
def play_sound():
# Play sound in a separate thread
playsound("audio/bells.wav")
def get_events():
list_events=[]
with open(events) as file: # Extracts events from event file
for line in file:
line=line.rstrip('\n') # Gets rid of the newline character
current_event=line.split('.') # Chops up the name from the date (name.#/#/##)
event_date = datetime.strptime(current_event[1], '%d/%m/%y'.date)
current_event[1] = event_date
list_events.append(current_event)
return list_events
# idk whats happening lines 19-21 im just reading a book
# Window init
root = Tk()
c = Canvas(root, width=800, height=800, bg='red') # Will change reslution later
root.resizable(False, False)
root.title("Christmas Countdown")
root.iconbitmap("window_icon.ico")
c.pack()
# Start the sound playback in a new thread
sound_thread = threading.Thread(target=play_sound)
sound_thread.start()
#Text creation
c.create_text(100, 50, anchor='w', fill='white', font='Arial 28 bold', text='Christmas countdown🎄')
print("Done loading")
root.mainloop()
playsound("audio/crisler.wav")