Пример #1
0
def validate():
	lat = float(elat.get())
	long = float(elong.get())
	alt = float(ealt.get())
	
	km = distance.km2points(lat, long, homelat, homelong)
	miles = distance.km2miles(km)
	if (alt>50):
		takeoff.set("takeoff state: 0")
		Label(master, text="Sorry your altitude should be below 50 meters, currently: " + ealt.get(), fg="white", bg="blue").grid(row=4, 
			column=0, columnspan=2, sticky=W+E)
		ealt.delete(0,END)
	elif (km > 1000000.60934):
		takeoff.set("takeoff state: 0")
		Label(master, text="Sorry the distance has to be under 1 mile, currently: " + str(miles) + " miles away!", 
			fg="white", bg="blue").grid(row=4, column=0, columnspan=2, sticky=W+E, padx=20, pady=20)
		elat.delete(0,END)
		elong.delete(0,END)
	else:
		elat.configure(state='readonly')
		elong.configure(state='readonly')
		ealt.configure(state='readonly')
		takeoff.set("takeoff state: 1")
		Label(master, text="Success you are ready to FLY!\nDestination: %.2f miles\nAltitude: %.0f meters" % (miles,alt), fg="white", bg="blue").grid(row=0, 
			column=2, rowspan=4, padx=20, pady=20, sticky=NS)
		Button(master, text='LAUNCH', command=store, fg="black", bg="green", font="bold").grid(row=0, column=3, 
			rowspan=2, sticky=N+S+E+W, ipadx=10, ipady=10, padx=10, pady=10)
		Button(master, text='ABORT', command=master.quit, fg="black", bg="red").grid(row=2, column=3, 
			rowspan=2, sticky=N+S+E+W, ipadx=10, ipady=5, padx=10, pady=10)
Пример #2
0
import distance
import time

km = distance.km2points(33.452, -88.787, 33.471, -88.770)
miles = distance.km2miles(km)
print km
print miles
time.sleep(3)
Пример #3
0
good = False
while good == False:
	alt = input('enter flying alt ')
	if (alt > 50):
		print 'sorry the alt is too high'
	else:
		good = True

good = False

while good == False:
	lat = input('enter lat ')
	long = input('enter long ')
	print 'verifying coordinates are not out of range'
	print '\n'
	km = distance.km2points(lat, long, homelat, homelong)
	miles = distance.km2miles(km)
	if (km > 1.60934):
		print 'sorry the entered coordinates are out of range'
		print 'the distance is %.2f miles' % miles
	else:
		print 'delivery distance: %.2f km - %.2f miles' % (km, miles)
		good = True
		


time.sleep(1)
print 'writing coords to file'

f = open('C:\\mission_scripts\\coords.txt', 'w')
Пример #4
0
def validate():
    lat = float(elat.get())
    long = float(elong.get())
    alt = float(ealt.get())

    km = distance.km2points(lat, long, homelat, homelong)
    miles = distance.km2miles(km)
    if (alt > 50):
        takeoff.set("takeoff state: 0")
        Label(
            master,
            text="Sorry your altitude should be below 50 meters, currently: " +
            ealt.get(),
            fg="white",
            bg="blue").grid(row=4, column=0, columnspan=2, sticky=W + E)
        ealt.delete(0, END)
    elif (km > 1000000.60934):
        takeoff.set("takeoff state: 0")
        Label(master,
              text="Sorry the distance has to be under 1 mile, currently: " +
              str(miles) + " miles away!",
              fg="white",
              bg="blue").grid(row=4,
                              column=0,
                              columnspan=2,
                              sticky=W + E,
                              padx=20,
                              pady=20)
        elat.delete(0, END)
        elong.delete(0, END)
    else:
        elat.configure(state='readonly')
        elong.configure(state='readonly')
        ealt.configure(state='readonly')
        takeoff.set("takeoff state: 1")
        Label(
            master,
            text=
            "Success you are ready to FLY!\nDestination: %.2f miles\nAltitude: %.0f meters"
            % (miles, alt),
            fg="white",
            bg="blue").grid(row=0,
                            column=2,
                            rowspan=4,
                            padx=20,
                            pady=20,
                            sticky=NS)
        Button(master,
               text='LAUNCH',
               command=store,
               fg="black",
               bg="green",
               font="bold").grid(row=0,
                                 column=3,
                                 rowspan=2,
                                 sticky=N + S + E + W,
                                 ipadx=10,
                                 ipady=10,
                                 padx=10,
                                 pady=10)
        Button(master, text='ABORT', command=master.quit, fg="black",
               bg="red").grid(row=2,
                              column=3,
                              rowspan=2,
                              sticky=N + S + E + W,
                              ipadx=10,
                              ipady=5,
                              padx=10,
                              pady=10)