Jump to content

Download and display the Astronomy Picture of the Day (APOD)


G+_Joe Maruschek
 Share

Recommended Posts

get-apod-pic2-2.jpg

Download and display the Astronomy Picture of the Day (APOD)

http://github.com/joemarus/get-apod

 

I wanted to learn Tkinter so I could create some windows and see if I could display some pictures.  That led me to write this program.  If you just run it, it will download and display today's Astronomy Picture of the Day (APOD) from http://apod.nasa.gov.  Pay attention to the command window that pops up because the explanation of the picture gets printed there!

But there's more!  If you run the script on the command line, you have the option of putting a date in this form: YYMMDD and the program will download and display the picture for that date. 

 

Usage:

python get-apod.py [YYMMDD]

 

Sometimes there is no picture because they have a video, but the program will still print out the explanation.

I hear we will talk about installing some external python libraries this week.  This program uses the Python Imaging Library (or one of its forks like pillow) to convert jpegs to a format that Tkinter can display. You can download the library here: http://www.pythonware.com/products/pil/

For macs and other platforms, you will probably also need to download libjpeg to make things work: http://www.ijg.org/

Feel free to download and modify it however you want.

Link to comment
Share on other sites

 Share

×
×
  • Create New...