GUI_V1.py
1 2 def update_gps_display(self): 3 """Step 18: Update GPS display and center map""" 4 try: 5 while not self.gps_data_queue.empty(): 6 gps_data = self.gps_data_queue.get_nowait() 7 self.current_gps = gps_data 8 9 # Update GPS label 10 self.gps_label.config( 11 text=f"GPS: Lat {gps_data.latitude:.6f}, Lon {gps_data.longitude:.6f}, Alt {gps_data.altitude:.1f}m") 12 13 # Update map 14 self.update_map_display(gps_data) 15 16 except queue.Empty: 17 pass 18 19 def update_map_display(self, gps_data): 20 """Step 18: Update map display with current GPS position""" 21 try: 22 self.map_label.config(text=f"Radar Position: {gps_data.latitude:.6f}, {gps_data.longitude:.6f}\n" 23 f"Altitude: {gps_data.altitude:.1f}m\n" 24 f"Coverage: 50km radius\n" 25 f"Map centered on GPS coordinates") 26 27 except Exception as e: 28 logging.error(f"Error updating map display: {e}") 29 30 def main(): 31 """Main application entry point""" 32 try: 33 root = tk.Tk() 34 app = RadarGUI(root) 35 root.mainloop() 36 except Exception as e: 37 logging.error(f"Application error: {e}") 38 messagebox.showerror("Fatal Error", f"Application failed to start: {e}") 39 40 if __name__ == "__main__": 41 main()