Skip to content

Instantly share code, notes, and snippets.

@fnneves
Last active July 16, 2019 23:41
Show Gist options
  • Select an option

  • Save fnneves/7e105541a98ca4e8e0b57bc7b859faaf to your computer and use it in GitHub Desktop.

Select an option

Save fnneves/7e105541a98ca4e8e0b57bc7b859faaf to your computer and use it in GitHub Desktop.
# two additional frames go inside the center_frame
frame_main_1 = tk.Frame(center_frame, borderwidth=2, relief='sunken')
frame_main_2 = tk.Frame(center_frame, borderwidth=2, relief='sunken')
# and populate them with the labels referring to the inputs we want from the user
from_city = tk.Label(frame_main_1, text = "FROM: ")
to_city = tk.Label(frame_main_2, text = "TO: ")
departure_date = tk.Label(frame_main_1, text = " DEPARTURE DATE:")
return_date = tk.Label(frame_main_2, text = " RETURN DATE:")
# Put it simply: StringVar() allows you to easily track tkinter variables and see if they were read, changed, etc
# check resources here for more details: http://effbot.org/tkinterbook/variable.htm
from_city1 = tk.StringVar()
to_city1 = tk.StringVar()
departure_date1 = tk.StringVar()
return_date1 = tk.StringVar()
# this part is just to display the labels inside the center frame
# the order which we pack the items is important
frame_main_1.pack(fill='x', pady=2)
frame_main_2.pack(fill='x',pady=2)
from_city.pack(side='left')
departure_date.pack(side='left', padx=5)
to_city.pack(side='left')
return_date.pack(side='right', padx=5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment