Plane Ticket Purchasing GUI

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
0
down vote

favorite












I'm a total newbie to Python and I decided to learn by building an app and picking up concepts along the way. I decided to make an app where you can view a catalog of plane flights. Once you click on one, a new screen appears where you can view a map of the plane, click on specific seat(s), and then the seat details will pop up on a sidebar.



Right now, I'm looking for someone to critique my code, and if possible, help me to switch frames (from catalog to seat map). Thanks!



main.py



import tkinter as tk
from tkinter import ttk

#dictionary of airline codes to interpret .txt file data
airlines = "CA": "Air China",
"AF": "Air France",
"NH": "All Nippon Airways",
"BA": "British Airways",
"MU": "China Eastern Airlines",
"CZ": "China Southern Airlines",
"DL": "Delta Air Lines",
"U2": "easyJet",
"MS": "EgyptAir",
"EK": "Emirates",
"IB": "Iberia",
"KL": "KLM Royal Dutch Airlines",
"DY": "Norwegian Air Shuttle",
"LH": "Lufthansa",
"QR": "Qatar Airways",
"FR": "Ryanair",
"WN": "Southwest Airlines",
"TK": "Turkish Airlines",
"UA": "United Airlines"

#dictionary of airport codes to interpret .txt file data
airports = "AMS": ("Amsterdam Airport Schipol", "North Holland", "Netherlands"),
"ATL": ("Hartsfield-Jackson Atlanta International Airport", "Atlanta", "United States"),
"BCN": ("Barcelona–El Prat Airport", "Barcelona", "Spain"),
"BKK": ("Suvarnabhumi Airport", "Bang Phil", "Thailand"),
"BOM": ("Chhatrapati Shivaji International Airport", "Mumbai", "India"),
"BVA": ("Beauvais–Tillé Airport", "Paris", "France"),
"CAN": ("Guangzhou Baiyun International Airport", "Guangzhou", "China"),
"CDG": ("Charles de Gaulle Airport", "Paris", "France"),
"CGK": ("Soekarno-Hatta International Airport", "Tangerang City", "Indonesia"),
"CTU": ("Chengdu Shuangliu International Airport", "Chengdu", "China"),
"DEL": ("Indira Gandhi International Airport", "Delhi", "India"),
"DEN": ("Denver International Airport", "Denver", "United States"),
"DFW": ("Dallas/Fort Worth International Airport", "Dallas-Fort Worth", "United States"),
"DTW": ("Detroit Metropolitan Airport", "Detroit", "United States"),
"DXB": ("Dubai International Airport", "Dubai", "United Arab Emirates"),
"FRA": ("Frankfurt Airport", "Frankfurt", "Germany"),
"HKG": ("Hong Kong International Airport", "Hong Kong", "China"),
"HND": ("Tokyo International Airport", "Tokyo", "Japan"),
"ICN": ("Seoul Incheon International Airport", "Incheon", "South Korea"),
"IST": ("Istanul Ataturk Airport", "Istanbul", "Turkey"),
"JFK": ("John F. Kennedy", "New York City", "United States"),
"KUL": ("Kuala Lumpur International Airport", "Sepang", "Malaysia"),
"LAS": ("McCarran International Airport", "Las Vegas", "United States"),
"LAX": ("Los Angeles International Airport", "Los Angeles", "United States"),
"LHR": ("Heathrow Airport", "London", "United Kingdom"),
"MAD": ("Madrid Barajas Airport", "Madrid", "Spain"),
"MIA": ("Miami International Airport", "Miami", "United States"),
"ORD": ("O'Hare International Airport", "Chicago", "United States"),
"PEK": ("Beijing Capital International Airport", "Beijing", "China"),
"PVG": ("Shanghai Pudong International Airport", "Shanghai", "China"),
"SEA": ("Seattle-Tacoma International Airport", "Seattle", "United States"),
"SFO": ("San Francisco International Airport", "San Francisco", "United States"),
"SIN": ("Singapore Changi Airport", "Singapore", "Singapore")


flight_list =

#copying .txt file data to an array for flight(s) info
with open('flights.txt') as f:
flight_data = f.readlines()

for counter in range(0, len(flight_data)):
flight_list.append(flight_data[counter].split())
counter += 1

print(flight_list)




root = tk.Tk()
root.title("AirTix")
root.minsize(width=800, height=450)

root.rowconfigure(0, weight=3)
root.rowconfigure(1, weight=2)
root.rowconfigure(2, weight=10)
root.columnconfigure(0, weight=4)
root.columnconfigure(1, weight=30)
root.columnconfigure(2, weight=1)

tk.Label(root, text = "Flights").grid(row=0, columnspan=2, sticky="w")

tk.Label(root, text = "Search").grid(row=1, sticky="w")
search = tk.Entry(root)
search.grid(row=1, column=1, sticky='ew')

fc_scroll = tk.Scrollbar(root)
fc_scroll.grid(row=2, column=2, sticky="nsew")
flight_catalog = ttk.Treeview(root, yscrollcommand=fc_scroll.set)
flight_catalog["columns"] = ("airline/flight code", "start time", "end time",
"start location", "end location", "date")
flight_catalog.column("airline/flight code", width=80)
flight_catalog.heading("airline/flight code", text="Flt. Code")
flight_catalog.column("start time", width=100)
flight_catalog.heading("start time", text="Departure")
flight_catalog.column("end time", width=100)
flight_catalog.heading("end time", text="Arrival")
flight_catalog.column("start location", width=220)
flight_catalog.heading("start location", text="From")
flight_catalog.column("end location", width=220)
flight_catalog.heading("end location", text="Destination")
flight_catalog.column("date", width=80)
flight_catalog.heading("date", text="Date")
flight_catalog.grid(row=2, columnspan=2, sticky="nsew")

flight_catalog["show"] = "headings"

for x in range(0, len(flight_list)):
flight_catalog.insert("", "end", values = (flight_list[x][0] + " " + flight_list[x][1],
flight_list[x][10],
flight_list[x][12],
(airports[flight_list[x][4]][1] + " (" + flight_list[x][4] + ")"), #location
(airports[flight_list[x][7]][1] + " (" + flight_list[x][7] + ")"),
flight_list[x][11]))

fc_scroll.config(command=flight_catalog.yview)


root.mainloop()


flights.txt



DL 583 Boeing 777-200LR DTW M A36 PVG 1 210 15:30 12/30/17 19:27 12/31/17
BA 8 Boeing 777 HND INTL n/a LHR 5 n/a 9:45 01/01/18 13:25 01/01/18
FR 6375 Boeing 737-800 BVA n/a n/a BCN 2 n/a 13:20 12/31/17 15:05 12/31/17






share|improve this question



























    up vote
    0
    down vote

    favorite












    I'm a total newbie to Python and I decided to learn by building an app and picking up concepts along the way. I decided to make an app where you can view a catalog of plane flights. Once you click on one, a new screen appears where you can view a map of the plane, click on specific seat(s), and then the seat details will pop up on a sidebar.



    Right now, I'm looking for someone to critique my code, and if possible, help me to switch frames (from catalog to seat map). Thanks!



    main.py



    import tkinter as tk
    from tkinter import ttk

    #dictionary of airline codes to interpret .txt file data
    airlines = "CA": "Air China",
    "AF": "Air France",
    "NH": "All Nippon Airways",
    "BA": "British Airways",
    "MU": "China Eastern Airlines",
    "CZ": "China Southern Airlines",
    "DL": "Delta Air Lines",
    "U2": "easyJet",
    "MS": "EgyptAir",
    "EK": "Emirates",
    "IB": "Iberia",
    "KL": "KLM Royal Dutch Airlines",
    "DY": "Norwegian Air Shuttle",
    "LH": "Lufthansa",
    "QR": "Qatar Airways",
    "FR": "Ryanair",
    "WN": "Southwest Airlines",
    "TK": "Turkish Airlines",
    "UA": "United Airlines"

    #dictionary of airport codes to interpret .txt file data
    airports = "AMS": ("Amsterdam Airport Schipol", "North Holland", "Netherlands"),
    "ATL": ("Hartsfield-Jackson Atlanta International Airport", "Atlanta", "United States"),
    "BCN": ("Barcelona–El Prat Airport", "Barcelona", "Spain"),
    "BKK": ("Suvarnabhumi Airport", "Bang Phil", "Thailand"),
    "BOM": ("Chhatrapati Shivaji International Airport", "Mumbai", "India"),
    "BVA": ("Beauvais–Tillé Airport", "Paris", "France"),
    "CAN": ("Guangzhou Baiyun International Airport", "Guangzhou", "China"),
    "CDG": ("Charles de Gaulle Airport", "Paris", "France"),
    "CGK": ("Soekarno-Hatta International Airport", "Tangerang City", "Indonesia"),
    "CTU": ("Chengdu Shuangliu International Airport", "Chengdu", "China"),
    "DEL": ("Indira Gandhi International Airport", "Delhi", "India"),
    "DEN": ("Denver International Airport", "Denver", "United States"),
    "DFW": ("Dallas/Fort Worth International Airport", "Dallas-Fort Worth", "United States"),
    "DTW": ("Detroit Metropolitan Airport", "Detroit", "United States"),
    "DXB": ("Dubai International Airport", "Dubai", "United Arab Emirates"),
    "FRA": ("Frankfurt Airport", "Frankfurt", "Germany"),
    "HKG": ("Hong Kong International Airport", "Hong Kong", "China"),
    "HND": ("Tokyo International Airport", "Tokyo", "Japan"),
    "ICN": ("Seoul Incheon International Airport", "Incheon", "South Korea"),
    "IST": ("Istanul Ataturk Airport", "Istanbul", "Turkey"),
    "JFK": ("John F. Kennedy", "New York City", "United States"),
    "KUL": ("Kuala Lumpur International Airport", "Sepang", "Malaysia"),
    "LAS": ("McCarran International Airport", "Las Vegas", "United States"),
    "LAX": ("Los Angeles International Airport", "Los Angeles", "United States"),
    "LHR": ("Heathrow Airport", "London", "United Kingdom"),
    "MAD": ("Madrid Barajas Airport", "Madrid", "Spain"),
    "MIA": ("Miami International Airport", "Miami", "United States"),
    "ORD": ("O'Hare International Airport", "Chicago", "United States"),
    "PEK": ("Beijing Capital International Airport", "Beijing", "China"),
    "PVG": ("Shanghai Pudong International Airport", "Shanghai", "China"),
    "SEA": ("Seattle-Tacoma International Airport", "Seattle", "United States"),
    "SFO": ("San Francisco International Airport", "San Francisco", "United States"),
    "SIN": ("Singapore Changi Airport", "Singapore", "Singapore")


    flight_list =

    #copying .txt file data to an array for flight(s) info
    with open('flights.txt') as f:
    flight_data = f.readlines()

    for counter in range(0, len(flight_data)):
    flight_list.append(flight_data[counter].split())
    counter += 1

    print(flight_list)




    root = tk.Tk()
    root.title("AirTix")
    root.minsize(width=800, height=450)

    root.rowconfigure(0, weight=3)
    root.rowconfigure(1, weight=2)
    root.rowconfigure(2, weight=10)
    root.columnconfigure(0, weight=4)
    root.columnconfigure(1, weight=30)
    root.columnconfigure(2, weight=1)

    tk.Label(root, text = "Flights").grid(row=0, columnspan=2, sticky="w")

    tk.Label(root, text = "Search").grid(row=1, sticky="w")
    search = tk.Entry(root)
    search.grid(row=1, column=1, sticky='ew')

    fc_scroll = tk.Scrollbar(root)
    fc_scroll.grid(row=2, column=2, sticky="nsew")
    flight_catalog = ttk.Treeview(root, yscrollcommand=fc_scroll.set)
    flight_catalog["columns"] = ("airline/flight code", "start time", "end time",
    "start location", "end location", "date")
    flight_catalog.column("airline/flight code", width=80)
    flight_catalog.heading("airline/flight code", text="Flt. Code")
    flight_catalog.column("start time", width=100)
    flight_catalog.heading("start time", text="Departure")
    flight_catalog.column("end time", width=100)
    flight_catalog.heading("end time", text="Arrival")
    flight_catalog.column("start location", width=220)
    flight_catalog.heading("start location", text="From")
    flight_catalog.column("end location", width=220)
    flight_catalog.heading("end location", text="Destination")
    flight_catalog.column("date", width=80)
    flight_catalog.heading("date", text="Date")
    flight_catalog.grid(row=2, columnspan=2, sticky="nsew")

    flight_catalog["show"] = "headings"

    for x in range(0, len(flight_list)):
    flight_catalog.insert("", "end", values = (flight_list[x][0] + " " + flight_list[x][1],
    flight_list[x][10],
    flight_list[x][12],
    (airports[flight_list[x][4]][1] + " (" + flight_list[x][4] + ")"), #location
    (airports[flight_list[x][7]][1] + " (" + flight_list[x][7] + ")"),
    flight_list[x][11]))

    fc_scroll.config(command=flight_catalog.yview)


    root.mainloop()


    flights.txt



    DL 583 Boeing 777-200LR DTW M A36 PVG 1 210 15:30 12/30/17 19:27 12/31/17
    BA 8 Boeing 777 HND INTL n/a LHR 5 n/a 9:45 01/01/18 13:25 01/01/18
    FR 6375 Boeing 737-800 BVA n/a n/a BCN 2 n/a 13:20 12/31/17 15:05 12/31/17






    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I'm a total newbie to Python and I decided to learn by building an app and picking up concepts along the way. I decided to make an app where you can view a catalog of plane flights. Once you click on one, a new screen appears where you can view a map of the plane, click on specific seat(s), and then the seat details will pop up on a sidebar.



      Right now, I'm looking for someone to critique my code, and if possible, help me to switch frames (from catalog to seat map). Thanks!



      main.py



      import tkinter as tk
      from tkinter import ttk

      #dictionary of airline codes to interpret .txt file data
      airlines = "CA": "Air China",
      "AF": "Air France",
      "NH": "All Nippon Airways",
      "BA": "British Airways",
      "MU": "China Eastern Airlines",
      "CZ": "China Southern Airlines",
      "DL": "Delta Air Lines",
      "U2": "easyJet",
      "MS": "EgyptAir",
      "EK": "Emirates",
      "IB": "Iberia",
      "KL": "KLM Royal Dutch Airlines",
      "DY": "Norwegian Air Shuttle",
      "LH": "Lufthansa",
      "QR": "Qatar Airways",
      "FR": "Ryanair",
      "WN": "Southwest Airlines",
      "TK": "Turkish Airlines",
      "UA": "United Airlines"

      #dictionary of airport codes to interpret .txt file data
      airports = "AMS": ("Amsterdam Airport Schipol", "North Holland", "Netherlands"),
      "ATL": ("Hartsfield-Jackson Atlanta International Airport", "Atlanta", "United States"),
      "BCN": ("Barcelona–El Prat Airport", "Barcelona", "Spain"),
      "BKK": ("Suvarnabhumi Airport", "Bang Phil", "Thailand"),
      "BOM": ("Chhatrapati Shivaji International Airport", "Mumbai", "India"),
      "BVA": ("Beauvais–Tillé Airport", "Paris", "France"),
      "CAN": ("Guangzhou Baiyun International Airport", "Guangzhou", "China"),
      "CDG": ("Charles de Gaulle Airport", "Paris", "France"),
      "CGK": ("Soekarno-Hatta International Airport", "Tangerang City", "Indonesia"),
      "CTU": ("Chengdu Shuangliu International Airport", "Chengdu", "China"),
      "DEL": ("Indira Gandhi International Airport", "Delhi", "India"),
      "DEN": ("Denver International Airport", "Denver", "United States"),
      "DFW": ("Dallas/Fort Worth International Airport", "Dallas-Fort Worth", "United States"),
      "DTW": ("Detroit Metropolitan Airport", "Detroit", "United States"),
      "DXB": ("Dubai International Airport", "Dubai", "United Arab Emirates"),
      "FRA": ("Frankfurt Airport", "Frankfurt", "Germany"),
      "HKG": ("Hong Kong International Airport", "Hong Kong", "China"),
      "HND": ("Tokyo International Airport", "Tokyo", "Japan"),
      "ICN": ("Seoul Incheon International Airport", "Incheon", "South Korea"),
      "IST": ("Istanul Ataturk Airport", "Istanbul", "Turkey"),
      "JFK": ("John F. Kennedy", "New York City", "United States"),
      "KUL": ("Kuala Lumpur International Airport", "Sepang", "Malaysia"),
      "LAS": ("McCarran International Airport", "Las Vegas", "United States"),
      "LAX": ("Los Angeles International Airport", "Los Angeles", "United States"),
      "LHR": ("Heathrow Airport", "London", "United Kingdom"),
      "MAD": ("Madrid Barajas Airport", "Madrid", "Spain"),
      "MIA": ("Miami International Airport", "Miami", "United States"),
      "ORD": ("O'Hare International Airport", "Chicago", "United States"),
      "PEK": ("Beijing Capital International Airport", "Beijing", "China"),
      "PVG": ("Shanghai Pudong International Airport", "Shanghai", "China"),
      "SEA": ("Seattle-Tacoma International Airport", "Seattle", "United States"),
      "SFO": ("San Francisco International Airport", "San Francisco", "United States"),
      "SIN": ("Singapore Changi Airport", "Singapore", "Singapore")


      flight_list =

      #copying .txt file data to an array for flight(s) info
      with open('flights.txt') as f:
      flight_data = f.readlines()

      for counter in range(0, len(flight_data)):
      flight_list.append(flight_data[counter].split())
      counter += 1

      print(flight_list)




      root = tk.Tk()
      root.title("AirTix")
      root.minsize(width=800, height=450)

      root.rowconfigure(0, weight=3)
      root.rowconfigure(1, weight=2)
      root.rowconfigure(2, weight=10)
      root.columnconfigure(0, weight=4)
      root.columnconfigure(1, weight=30)
      root.columnconfigure(2, weight=1)

      tk.Label(root, text = "Flights").grid(row=0, columnspan=2, sticky="w")

      tk.Label(root, text = "Search").grid(row=1, sticky="w")
      search = tk.Entry(root)
      search.grid(row=1, column=1, sticky='ew')

      fc_scroll = tk.Scrollbar(root)
      fc_scroll.grid(row=2, column=2, sticky="nsew")
      flight_catalog = ttk.Treeview(root, yscrollcommand=fc_scroll.set)
      flight_catalog["columns"] = ("airline/flight code", "start time", "end time",
      "start location", "end location", "date")
      flight_catalog.column("airline/flight code", width=80)
      flight_catalog.heading("airline/flight code", text="Flt. Code")
      flight_catalog.column("start time", width=100)
      flight_catalog.heading("start time", text="Departure")
      flight_catalog.column("end time", width=100)
      flight_catalog.heading("end time", text="Arrival")
      flight_catalog.column("start location", width=220)
      flight_catalog.heading("start location", text="From")
      flight_catalog.column("end location", width=220)
      flight_catalog.heading("end location", text="Destination")
      flight_catalog.column("date", width=80)
      flight_catalog.heading("date", text="Date")
      flight_catalog.grid(row=2, columnspan=2, sticky="nsew")

      flight_catalog["show"] = "headings"

      for x in range(0, len(flight_list)):
      flight_catalog.insert("", "end", values = (flight_list[x][0] + " " + flight_list[x][1],
      flight_list[x][10],
      flight_list[x][12],
      (airports[flight_list[x][4]][1] + " (" + flight_list[x][4] + ")"), #location
      (airports[flight_list[x][7]][1] + " (" + flight_list[x][7] + ")"),
      flight_list[x][11]))

      fc_scroll.config(command=flight_catalog.yview)


      root.mainloop()


      flights.txt



      DL 583 Boeing 777-200LR DTW M A36 PVG 1 210 15:30 12/30/17 19:27 12/31/17
      BA 8 Boeing 777 HND INTL n/a LHR 5 n/a 9:45 01/01/18 13:25 01/01/18
      FR 6375 Boeing 737-800 BVA n/a n/a BCN 2 n/a 13:20 12/31/17 15:05 12/31/17






      share|improve this question













      I'm a total newbie to Python and I decided to learn by building an app and picking up concepts along the way. I decided to make an app where you can view a catalog of plane flights. Once you click on one, a new screen appears where you can view a map of the plane, click on specific seat(s), and then the seat details will pop up on a sidebar.



      Right now, I'm looking for someone to critique my code, and if possible, help me to switch frames (from catalog to seat map). Thanks!



      main.py



      import tkinter as tk
      from tkinter import ttk

      #dictionary of airline codes to interpret .txt file data
      airlines = "CA": "Air China",
      "AF": "Air France",
      "NH": "All Nippon Airways",
      "BA": "British Airways",
      "MU": "China Eastern Airlines",
      "CZ": "China Southern Airlines",
      "DL": "Delta Air Lines",
      "U2": "easyJet",
      "MS": "EgyptAir",
      "EK": "Emirates",
      "IB": "Iberia",
      "KL": "KLM Royal Dutch Airlines",
      "DY": "Norwegian Air Shuttle",
      "LH": "Lufthansa",
      "QR": "Qatar Airways",
      "FR": "Ryanair",
      "WN": "Southwest Airlines",
      "TK": "Turkish Airlines",
      "UA": "United Airlines"

      #dictionary of airport codes to interpret .txt file data
      airports = "AMS": ("Amsterdam Airport Schipol", "North Holland", "Netherlands"),
      "ATL": ("Hartsfield-Jackson Atlanta International Airport", "Atlanta", "United States"),
      "BCN": ("Barcelona–El Prat Airport", "Barcelona", "Spain"),
      "BKK": ("Suvarnabhumi Airport", "Bang Phil", "Thailand"),
      "BOM": ("Chhatrapati Shivaji International Airport", "Mumbai", "India"),
      "BVA": ("Beauvais–Tillé Airport", "Paris", "France"),
      "CAN": ("Guangzhou Baiyun International Airport", "Guangzhou", "China"),
      "CDG": ("Charles de Gaulle Airport", "Paris", "France"),
      "CGK": ("Soekarno-Hatta International Airport", "Tangerang City", "Indonesia"),
      "CTU": ("Chengdu Shuangliu International Airport", "Chengdu", "China"),
      "DEL": ("Indira Gandhi International Airport", "Delhi", "India"),
      "DEN": ("Denver International Airport", "Denver", "United States"),
      "DFW": ("Dallas/Fort Worth International Airport", "Dallas-Fort Worth", "United States"),
      "DTW": ("Detroit Metropolitan Airport", "Detroit", "United States"),
      "DXB": ("Dubai International Airport", "Dubai", "United Arab Emirates"),
      "FRA": ("Frankfurt Airport", "Frankfurt", "Germany"),
      "HKG": ("Hong Kong International Airport", "Hong Kong", "China"),
      "HND": ("Tokyo International Airport", "Tokyo", "Japan"),
      "ICN": ("Seoul Incheon International Airport", "Incheon", "South Korea"),
      "IST": ("Istanul Ataturk Airport", "Istanbul", "Turkey"),
      "JFK": ("John F. Kennedy", "New York City", "United States"),
      "KUL": ("Kuala Lumpur International Airport", "Sepang", "Malaysia"),
      "LAS": ("McCarran International Airport", "Las Vegas", "United States"),
      "LAX": ("Los Angeles International Airport", "Los Angeles", "United States"),
      "LHR": ("Heathrow Airport", "London", "United Kingdom"),
      "MAD": ("Madrid Barajas Airport", "Madrid", "Spain"),
      "MIA": ("Miami International Airport", "Miami", "United States"),
      "ORD": ("O'Hare International Airport", "Chicago", "United States"),
      "PEK": ("Beijing Capital International Airport", "Beijing", "China"),
      "PVG": ("Shanghai Pudong International Airport", "Shanghai", "China"),
      "SEA": ("Seattle-Tacoma International Airport", "Seattle", "United States"),
      "SFO": ("San Francisco International Airport", "San Francisco", "United States"),
      "SIN": ("Singapore Changi Airport", "Singapore", "Singapore")


      flight_list =

      #copying .txt file data to an array for flight(s) info
      with open('flights.txt') as f:
      flight_data = f.readlines()

      for counter in range(0, len(flight_data)):
      flight_list.append(flight_data[counter].split())
      counter += 1

      print(flight_list)




      root = tk.Tk()
      root.title("AirTix")
      root.minsize(width=800, height=450)

      root.rowconfigure(0, weight=3)
      root.rowconfigure(1, weight=2)
      root.rowconfigure(2, weight=10)
      root.columnconfigure(0, weight=4)
      root.columnconfigure(1, weight=30)
      root.columnconfigure(2, weight=1)

      tk.Label(root, text = "Flights").grid(row=0, columnspan=2, sticky="w")

      tk.Label(root, text = "Search").grid(row=1, sticky="w")
      search = tk.Entry(root)
      search.grid(row=1, column=1, sticky='ew')

      fc_scroll = tk.Scrollbar(root)
      fc_scroll.grid(row=2, column=2, sticky="nsew")
      flight_catalog = ttk.Treeview(root, yscrollcommand=fc_scroll.set)
      flight_catalog["columns"] = ("airline/flight code", "start time", "end time",
      "start location", "end location", "date")
      flight_catalog.column("airline/flight code", width=80)
      flight_catalog.heading("airline/flight code", text="Flt. Code")
      flight_catalog.column("start time", width=100)
      flight_catalog.heading("start time", text="Departure")
      flight_catalog.column("end time", width=100)
      flight_catalog.heading("end time", text="Arrival")
      flight_catalog.column("start location", width=220)
      flight_catalog.heading("start location", text="From")
      flight_catalog.column("end location", width=220)
      flight_catalog.heading("end location", text="Destination")
      flight_catalog.column("date", width=80)
      flight_catalog.heading("date", text="Date")
      flight_catalog.grid(row=2, columnspan=2, sticky="nsew")

      flight_catalog["show"] = "headings"

      for x in range(0, len(flight_list)):
      flight_catalog.insert("", "end", values = (flight_list[x][0] + " " + flight_list[x][1],
      flight_list[x][10],
      flight_list[x][12],
      (airports[flight_list[x][4]][1] + " (" + flight_list[x][4] + ")"), #location
      (airports[flight_list[x][7]][1] + " (" + flight_list[x][7] + ")"),
      flight_list[x][11]))

      fc_scroll.config(command=flight_catalog.yview)


      root.mainloop()


      flights.txt



      DL 583 Boeing 777-200LR DTW M A36 PVG 1 210 15:30 12/30/17 19:27 12/31/17
      BA 8 Boeing 777 HND INTL n/a LHR 5 n/a 9:45 01/01/18 13:25 01/01/18
      FR 6375 Boeing 737-800 BVA n/a n/a BCN 2 n/a 13:20 12/31/17 15:05 12/31/17








      share|improve this question












      share|improve this question




      share|improve this question








      edited Jan 6 at 1:03









      Sam Onela

      5,88461545




      5,88461545









      asked Jan 5 at 23:55









      Java Programmer in Training

      12




      12

























          active

          oldest

          votes











          Your Answer




          StackExchange.ifUsing("editor", function ()
          return StackExchange.using("mathjaxEditing", function ()
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
          );
          );
          , "mathjax-editing");

          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "196"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f184408%2fplane-ticket-purchasing-gui%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes










           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f184408%2fplane-ticket-purchasing-gui%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          Greedy Best First Search implementation in Rust

          Function to Return a JSON Like Objects Using VBA Collections and Arrays

          C++11 CLH Lock Implementation