addition of altitude set button

This commit is contained in:
Technoduck 2024-11-24 12:28:19 -05:00
parent 7cb39c679e
commit 5ef80458c2

24
app.py
View file

@ -51,6 +51,7 @@ class renderedImageZoom:
self.set_sun(90)
self.fisheye = False
self.curr_env = 0
self.coords = (0,0)
self.zoom_factor = 1
self.env_list = ["cont_clean","cont_avr","cont_poll","urban","desert","mar_clean","mar_poll","mar_tro","arctic","antarctic"]
@ -188,10 +189,20 @@ class renderedImageZoom:
s_frame.grid(column=0,row=9,columnspan=2,padx=20)
## Altitude
a_frame = tkinter.Frame(self.aerosol_window)
text_a = tkinter.Text(a_frame,height=1,width=10)
submit_a_button = tkinter.Button(a_frame,text="Override altitude",command=lambda: self.set_altitute(int(text_a.get("1.0","end-1c"))))
self.alt_label = tkinter.Label(a_frame,text="choose location to set altitude")
text_a.pack(side=tkinter.LEFT)
self.alt_label.pack(side=tkinter.RIGHT)
submit_a_button.pack(side=tkinter.RIGHT)
a_frame.grid(column=0,row=10,columnspan=2,padx=20)
testing_info_text = tkinter.Label(self.aerosol_window, text="Change y heights between which average redness and blueness will be calculated")
testing_info_text.grid(column=0,row=10,columnspan=2,pady=20,padx=10)
testing_info_text.grid(column=0,row=11,columnspan=2,pady=20,padx=10)
r_frame = tkinter.Frame(self.aerosol_window)
text_r_l = tkinter.Text(r_frame,height=1,width=10)
@ -203,7 +214,7 @@ class renderedImageZoom:
text_r_u.pack(side=tkinter.LEFT)
average_r_label.pack(side=tkinter.RIGHT)
submit_r_button.pack(side=tkinter.RIGHT)
r_frame.grid(column=0,row=11,columnspan=2,padx=20)
r_frame.grid(column=0,row=12,columnspan=2,padx=20)
b_frame = tkinter.Frame(self.aerosol_window)
@ -216,7 +227,7 @@ class renderedImageZoom:
text_b_u.pack(side=tkinter.LEFT)
average_b_label.pack(side=tkinter.RIGHT)
submit_b_button.pack(side=tkinter.RIGHT)
b_frame.grid(column=0,row=12,columnspan=2,padx=20)
b_frame.grid(column=0,row=13,columnspan=2,padx=20)
#self.img = Image.fromarray(image,mode="RGB")
#self.tk_image = ImageTk.PhotoImage(width=256,height=256,image=self.img)
@ -256,6 +267,9 @@ class renderedImageZoom:
self.temperature = int(temp)
print("temperature set at ",temp)
def set_altitute(self,alt):
self.alt_label.config(text=str(alt) + " m")
self.altitude = alt
def set_sun(self,angle):
if angle is None:
@ -376,8 +390,8 @@ class renderedImageZoom:
r = requests.get(URL,params)
data = r.json()
print(data['results'][0]['elevation'])
self.altitude = data['results'][0]['elevation']
self.set_altitute(data['results'][0]['elevation'])