User avatar
Brienne
Posts: 21
Joined: Wed Oct 08, 2014 11:02 am
Location: Frogs hell

First noob project - Date, time and saint day

Tue Oct 21, 2014 2:03 pm

Hello,
I just installed my first RPI and set up SSH (RPi with static local adress).
Here is my first project, maybe very easy for many of you.

I'd like my RPI to display a picture (fullscreen) with date and time.
1- I guess I need a time synchronization with NTP http://en.wikipedia.org/wiki/Network_Time_Protocol. (No Real Time Clock stuck on my RPI)
2- Need to choose a letter font, and set size and place of "date".
3- Is there any way to add automatically Saint day?

So, I would get something like:
Friday 21 october
St Hilarion
15H59
and a picture behind.

For the moment, I absolutely don't know how to do. That's part of this noob challenge.

Any tips are welcome.
Thanks for your help.
Last edited by Brienne on Tue Oct 21, 2014 2:17 pm, edited 1 time in total.

User avatar
Brienne
Posts: 21
Joined: Wed Oct 08, 2014 11:02 am
Location: Frogs hell

Re: First noob project - Date, time and saint day

Tue Oct 21, 2014 2:15 pm

http://www.raspberrypi.org/forums/viewt ... 91&t=16058
Thread related to NTP / time settings
Trying to get it.

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: First noob project - Date, time and saint day

Tue Oct 21, 2014 2:52 pm

sudo apt-get install remind
man remind

That's a very good calendar with lots of function for doing stuff like saint's days and Jewish festivals.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
Brienne
Posts: 21
Joined: Wed Oct 08, 2014 11:02 am
Location: Frogs hell

Re: First noob project - Date, time and saint day

Tue Oct 21, 2014 2:55 pm

Thank you. Gonna RTFM for remind.

Is this project doable with Python?

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: First noob project - Date, time and saint day

Tue Oct 21, 2014 2:57 pm

Brienne wrote:Is this project doable with Python?
Is anything possible with that awful programming language? It's not my first choice.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
Brienne
Posts: 21
Joined: Wed Oct 08, 2014 11:02 am
Location: Frogs hell

Re: First noob project - Date, time and saint day

Tue Oct 21, 2014 3:01 pm

And then i understood i got to learn Python, Java, PHP,... :o

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: First noob project - Date, time and saint day

Tue Oct 21, 2014 4:10 pm

DougieLawson wrote:
Brienne wrote:Is this project doable with Python?
Is anything possible with that awful programming language? It's not my first choice.
Sometimes @DougieLawson forgets to make it clear when he is not being entirely serious. Although it may not be his first choice, he has written an article in Issue 27 of TheMagPi magazine which shows that it is possible to use python to generate QR codes with Minecraft.

Just as musicians practice scales and athletes do warm-ups, some programmers keep their skills up-to-date by having a simple project which they revisit and reimplement using as many different programming languages as possible. That way they learn the strengths and weaknesses of the languages at first hand.

So your calendar project is possibly 'doable' with Python. But then you could consider redoing it in Ruby, Javascript, Lua, C, C++, perl, or even just a shell script such as bash. And many others I haven't listed.

scotty101
Posts: 3958
Joined: Fri Jun 08, 2012 6:03 pm

Re: First noob project - Date, time and saint day

Tue Oct 21, 2014 4:40 pm

It is very possible in python

You'd need to have a lookup table or database storing all the Saint's days.

Then you'd have to compare the current date to see which of the Saint's day falls on today.

Code: Select all

from datetime import date

#Store our important dates
#Format is [(Day,Month),"Text of Day"]
importantDates = [[(3,7),"Saint Scott's"],
                  [(1,1),"New Years"],
                  [(21,10),"Day I wrote this"]]

#Get today's date
today = date.today()

#Step through each of the items in important dates
for date in importantDates:
    #Does the current date equal today's date?
    if date[0] == (today.day,today.month):
        #If it does print today's Saint day
        print "It is %s Day" % date[1]
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

Return to “Other projects”