Still working on clearing images.


# !/bin/python3


import json
import time
import turtle
import urllib.request

count = 1
while count > 0:


url = 'http://api.open-notify.org/astros.json'
response = urllib.request.urlopen(url)
result = json.loads(response.read())


url2 = 'http://api.open-notify.org/iss-now.json'
response2 = urllib.request.urlopen(url2)
result2 = json.loads(response2.read())
people = result['people']


location = result2['iss_position']
lat = location['latitude']
lat = float(lat)
lon = location['longitude']
lon = float(lon)


screen = turtle.Screen()
screen.setup(720, 360)
screen.setworldcoordinates(-180, -90, 180, 90)
screen.bgpic('map.gif')


screen.register_shape('iss.gif')
iss = turtle.Turtle()
iss.shape('iss.gif')
iss.setheading(90)


iss.speed('fastest')
iss.penup()
iss.goto(lon, lat)

# set marker location for Clinton, Township
lat_man = 42.58502
lon_man = -82.916985
location_man = turtle.Turtle()
location_man.penup()
location_man.color('yellow')
location_man.goto(lon_man, lat_man)
location_man.dot(5)
location_man.hideturtle()

url_man = 'http://api.open-notify.org/iss-pass.json?lat=42.58502&lon=-82.916985'
response_man = urllib.request.urlopen(url_man)
result_man = json.loads(response_man.read())
over_man = result_man['response'][1]['risetime']

style = ('Arial', 8, 'bold')
location_man.write(time.ctime(over_man), font=style)

coor_lon = -42.0
coor_lat = -170.0
location_lon = turtle.Turtle()
location_lon.penup()
location_lon.color('yellow')
location_lon.goto(coor_lat, coor_lon)
location_lon.hideturtle()
location_lon.speed('fastest')

style = ('Arial', 8, 'bold')
location_lon.write('Longitude', font=style)

coor_lon = -42.0
coor_lat = -140.0
location_lon = turtle.Turtle()
location_lon.penup()
location_lon.color('yellow')
location_lon.goto(coor_lat, coor_lon)
location_lon.hideturtle()

style = ('Arial', 8, 'bold')
location_lon.clear()
location_lon.write(lon, font=style)

# ISS Latitude
coor_lon = -49.0
coor_lat = -170.0
location_lon = turtle.Turtle()
location_lon.penup()
location_lon.color('yellow')
location_lon.goto(coor_lat, coor_lon)
location_lon.hideturtle()

style = ('Arial', 8, 'bold')
location_lon.write('Latitude', font=style)

# ISS Longitude
coor_lon = -49.0
coor_lat = -140.0

location_lon = turtle.Turtle()
location_lon.penup()
location_lon.color('yellow')
location_lon.goto(coor_lat, coor_lon)
location_lon.hideturtle()

style = ('Arial', 8, 'bold')
location_lon.write(lat, font=style)

# people on ISS
number_on_iss = len(people)
start_name_lon = -22.0
for p in people:
coor_lon = start_name_lon
coor_lat = 55.0
location_lon = turtle.Turtle()
location_lon.penup()
location_lon.color('yellow')
location_lon.goto(coor_lat, coor_lon)
location_lon.hideturtle()

style = ('Arial', 8, 'bold')
location_lon.write(p['name'], font=style)
start_name_lon -= 7

turtle.mainloop()
time.sleep(0.01)