-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
89 lines (56 loc) · 1.79 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
from csv import DictReader
import random
from tkinter import *
from datetime import datetime
import os
os.chdir('E:/COMPLETED_ SCRIPTS/DeeQuotes')
f = open('success.csv', 'r')
r = DictReader(f)
thoughts_l = []
writer_l = []
for row in r:
thoughts_l.append(row['QUOTE'])
writer_l.append(row['AUTHOR'])
rand_int = random.randint(0,len(thoughts_l)-1)
thought_for_the_day = thoughts_l[rand_int]
c = 1
thought = []
temp = ''
for i in thought_for_the_day.split():
temp += ' '+i
if c == 5:
thought.append(temp)
temp = ''
c = 0
c+=1
thought.append(temp)
thought.append(f'- {writer_l[rand_int]}')
win = Tk()
win.geometry('550x400+260+140')
win.resizable(0,0)
win.title('Thought Of The Day')
good_morning_img = PhotoImage(file='resources/g_morning.png')
good_afternoon_img = PhotoImage(file='resources/g_after.png')
good_evening_img = PhotoImage(file='resources/g_evening.png')
if len(thought) > 6:
win.geometry('550x450+260+140')
if len(thought) > 8:
win.geometry('550x500+260+130')
if len(thought) > 10:
win.geometry('550x550+260+120')
if len(thought) > 12:
win.geometry('550x620+260+100')
t = datetime.now().strftime('%H hours and %M minutes')
o= t.split()
if int(o[0]) < 12:
cur_img = good_morning_img
elif int(o[0]) > 12 and int(o[0]) < 17 :
cur_img = good_afternoon_img
else:
cur_img = good_evening_img
Label(win, image=cur_img).pack()
t_img = PhotoImage(file='resources/t_img.png')
Label(win, image=t_img).pack(side=LEFT)
thought = '\n'.join(thought)
Label(win, text=thought,font=('Segoe Script',13)).place(x=150,y=230)
win.mainloop()