def get_weather(self, event=None): for widget in self.info_city.winfo_children(): widget.destroy() city_name = self.entry.get() if len(city_name) != 0: weather = Weather(city_name) informations = weather.extract_component(city_name + ".txt") name_label = tk.Label(self.info_city, text="Météo actuelle à " + city_name, font=self.fontStyle) name_label.grid(padx=20, pady=15) cloud_label = tk.Label(self.info_city, text="Temps: " + informations[0], font=self.fontStyle) cloud_label.grid(padx=10, pady=10) temp_label = tk.Label(self.info_city, text="Température: " + str(informations[1]), font=self.fontStyle) temp_label.grid(padx=10, pady=10) preassure_label = tk.Label(self.info_city, text="Pression: " + str(informations[2]) + "hPa", font=self.fontStyle) preassure_label.grid(padx=10, pady=10) humidity_label = tk.Label(self.info_city, text="Humidité: " + str(informations[3]) + "%", font=self.fontStyle) humidity_label.grid(padx=10, pady=10) else: messagebox.showerror("Erreur", "Le nom de la ville est vide.")