import tkinter as tk from tkinter import messagebox import requests def flightinfo(flight): params = { 'access_key': '??????????????', 'flight_iata': flight } api_result = requests.get('https://api.aviationstack.com/v1/flights', params) api_response = api_result.json() return api_response['data'][0]['flight_status'], api_response['data'][0]['departure']['airport'], api_response['data'][0]['arrival']['airport'] def check_flight(): flight_no = entry_flight_no.get().upper() status, depart, arrival = flightinfo(flight_no) status_var.set(f"Status: {status}") departing_city_var.set(f"Departing City: {depart}") arriving_city_var.set(f"Arriving City: {arrival}") # Create the main window root = tk.Tk() root.title("Flight Status Checker") root.configure(bg='black') # Set the background color to black root.geometry("400x200") # Set the width and height of the window # Create and place the widgets label_flight_no = tk.Label(root, text="Enter Flight Number:", bg='black', fg='white') label_flight_no.pack(pady=5) entry_flight_no = tk.Entry(root, justify='center') entry_flight_no.pack(pady=5) button_check = tk.Button(root, text="Check Status", command=check_flight, bg='white', fg='black') button_check.pack(pady=5) status_var = tk.StringVar() label_status = tk.Label(root, textvariable=status_var, bg='black', fg='white') label_status.pack(pady=5) departing_city_var = tk.StringVar() label_departing_city = tk.Label(root, textvariable=departing_city_var, bg='black', fg='white') label_departing_city.pack(pady=5) arriving_city_var = tk.StringVar() label_arriving_city = tk.Label(root, textvariable=arriving_city_var, bg='black', fg='white') label_arriving_city.pack(pady=5) # Run the main event loop root.mainloop()