-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path#Monty.py#
32 lines (28 loc) · 940 Bytes
/
#Monty.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
'''Monty the motivational penguin, a free tool for astrophysics students at Oxford to help them destress when coding.
Written by Sam Spencer 13/3/2018, provided as is.'''
import numpy as np
import matplotlib.pyplot as plt
import csv
import os
from PIL import Image,ImageFont,ImageDraw
import time
import psutil
filedir=os.path.dirname(os.path.abspath(__file__))
database=[]
with open(filedir+'/quotes_all.csv') as csvfile:
quotesdat=csv.reader(csvfile,delimiter=';')
for row in quotesdat:
database.append(row[0])
while True:
quote=''
while len(quote)==0:
randomnumber=np.random.randint(len(database))
testquote=database[randomnumber]
if len(testquote)<50:
quote=testquote
else:
continue
penguin=Image.open(filedir+'/penguin-funny-blue-water-86405.jpeg')
draw = ImageDraw.Draw(penguin)
proc.kill()
time.sleep(1200)