def home_page(self): self.GUI() knowledge = Knowledge() '''Location and time for home''' time_json, str_time, str_day = knowledge.time_knowledge() clock = tk.Label(self.window, text=str_day, font=('Arial', 17), fg='white', bg='black') clock.place(relx=0.1, rely=0.1, anchor="center") clock = tk.Label(self.window, text=str_time, font=('Arial', 30), fg='white', bg='black') clock.place(relx=0.1, rely=0.05, anchor="center") '''weather for home''' weather_json = knowledge.weather_knowledge() temp = weather_json['main']['temp'] print(temp) #temp = float(5/9)*(float(temp)-32 ) temp = int(temp) - 273 print(temp) self.display()
def update_temp(): global temp1 global temp_ knowledge = Knowledge() weather_json = knowledge.weather_knowledge() location_json = knowledge.location_knowledge() temp_ = weather_json['main']['temp'] location_temp = location_json['state_prov'] if temp1 != temp_: temp1 = temp_ text = int(temp1 - 273) temp.config(text=location_temp + "City\n%d oC" % text) temp.after(50000, update_greeting)
def weather_action(self): weather_json = Knowledge.weather_knowledge()