7
7
import tkinter .messagebox as mbox
8
8
import pandas as pd
9
9
10
-
10
+ # created main window
11
11
window = Tk ()
12
12
window .geometry ("1000x700" )
13
13
window .title ("Direct Flight Route Finder" )
14
14
15
- # ---------------------------------------------------------
15
+ # ------------------- for adding gif image in main winfdow --------------------------------------
16
16
frameCnt = 3
17
17
frames = [PhotoImage (file = 'Images/flight.gif' ,format = 'gif -index %i' % (i )) for i in range (frameCnt )]
18
18
@@ -33,18 +33,14 @@ def update(ind):
33
33
window .after (0 , update , 0 )
34
34
# --------------------------------------------------------------------
35
35
36
+ # read the data from the csv file
36
37
data = pd .read_csv ("flight1z.csv" )
37
38
source_airport_list = data ["source_airport" ].tolist ()
38
39
source_airport_id_list = data ["source_airport_id" ].tolist ()
39
40
destination_airport_list = data ["destination_airport" ].tolist ()
40
41
destination_airport_id_list = data ["destination_airport_id" ].tolist ()
41
42
42
- # print(source_airport_list)
43
- # print(source_airport_id_list)
44
- # print(destination_airport_list)
45
- # print(destination_airport_id_list)
46
-
47
-
43
+ # function to find if route exist
48
44
def find_route ():
49
45
src = first_var .get ()
50
46
dest = second_var .get ()
@@ -100,22 +96,25 @@ def find_route():
100
96
second_menu .place (x = 650 , y = 500 )
101
97
second_var .set ("KZN" ) # size 1 is selected as by default, and we can
102
98
103
-
99
+ # created find button
104
100
findb = Button (window , text = "FIND" ,command = find_route ,font = ("Arial" , 20 ), bg = "light green" , fg = "blue" , borderwidth = 3 , relief = "raised" )
105
101
findb .place (x = 200 , y = 600 )
106
102
103
+ # function to reset the selected value
107
104
def reset_label ():
108
105
first_var .set ("AER" )
109
106
second_var .set ("KZN" )
110
107
108
+ # created reset button
111
109
resetb = Button (window , text = "RESET" ,command = reset_label ,font = ("Arial" , 20 ), bg = "light green" , fg = "blue" , borderwidth = 3 , relief = "raised" )
112
110
resetb .place (x = 420 , y = 600 )
113
111
114
-
112
+ # function for exiting
115
113
def exit_win ():
116
114
if mbox .askokcancel ("Exit" , "Do you want to exit?" ):
117
115
window .destroy ()
118
116
117
+ # created exit button
119
118
exitb = Button (window , text = "EXIT" ,command = exit_win ,font = ("Arial" , 20 ), bg = "red" , fg = "blue" , borderwidth = 3 , relief = "raised" )
120
119
exitb .place (x = 660 , y = 600 )
121
120
0 commit comments