import tkinter as tk
from tkinter import ttk, messagebox
import csv
import os
import random
CSV_FILE = "travel_users.csv"
if not [Link](CSV_FILE):
with open(CSV_FILE, "w", newline="") as file:
writer = [Link](file)
[Link](["Name", "Phone", "Destination", "Duration", "Hotel Type", "Budget"])
destinations = [
"Paris", "New York", "Los Angeles", "Tokyo", "London", "Dubai", "Bali", "Singapore",
"Rome", "Barcelona", "Amsterdam", "Istanbul", "Bangkok", "Hong Kong", "Seoul", "Sydney",
"Melbourne", "Moscow", "Cairo", "Rio de Janeiro", "Cape Town", "Athens", "Lisbon", "Vienna",
"Prague", "Budapest", "Dublin", "Oslo", "Stockholm", "Helsinki", "Zurich", "Munich",
"Venice", "Florence", "Santorini", "Kuala Lumpur", "Phuket", "Maldives", "New Delhi",
"Agra", "Jaipur", "Beijing", "Shanghai", "Kyoto", "Osaka", "Toronto", "Vancouver",
"Chicago", "Miami", "San Francisco", "Mexico City"
]
destinations_info = {
"Paris": {
"attractions": [
"Eiffel Tower", "Louvre Museum", "Seine River Cruise", "Notre-Dame Cathedral",
"Montmartre", "Arc de Triomphe", "Luxembourg Gardens", "Palace of Versailles",
"Musee d'Orsay", "Sainte-Chapelle"
],
"culture": "Language: French\nCuisine: Croissant, Baguette, Wine\nFamous For: Fashion,
Art\nCustoms: Greet with 'Bonjour'"
},
"New York": {
"attractions": [
"Statue of Liberty", "Times Square", "Central Park", "Brooklyn Bridge",
"Empire State Building", "Rockefeller Center", "High Line", "MET Museum",
"One World Observatory", "Broadway"
],
"culture": "Language: English\nCuisine: Pizza, Bagels\nFamous For: Skyscrapers,
Entertainment\nCustoms: Tipping is important"
},
}
fallback_attractions = [
"City Square", "Historic District", "Main Museum",
"Local Market", "Popular Park", "Cultural Area"
]
fallback_culture = "General Culture: Respect local customs, try traditional food, visit markets."
def chatbot_response(msg):
text = [Link]().strip()
rules = {
"hello": "Hello! How can I assist with your travel plans?",
"hi": "Hi there! Which destination are you thinking about?",
"help": "I can help with destinations, budgets, itineraries, and attractions.",
"beach": "Best beach destinations: Bali, Maldives, Phuket, Miami, Santorini.",
"budget": "Budget-friendly places: Bangkok, Bali, Istanbul, Lisbon, Jaipur.",
"cheap": "Try cheap destinations like Bali, Jaipur, or Bangkok.",
"visa": "Visa rules vary by country. Check your local embassy website.",
"safety": "General Safety: Keep valuables safe and avoid isolated areas at night.",
"culture": "Every destination has unique traditions. Respect locals and enjoy!",
"food": "Trying local dishes is recommended in every destination."
}
for d in destinations:
if [Link]() in text:
info = destinations_info.get(d)
if info:
return (
f"Information about {d}:\n"
f"Top Spots: {', '.join(info['attractions'][:3])}\n\n"
f"Culture:\n{info['culture']}"
)
else:
return (
f"{d} sounds great! Try visiting: "
f"{fallback_attractions[0]}, {fallback_attractions[1]}, {fallback_attractions[2]}."
)
for key, reply in [Link]():
if key in text:
return reply
return "I'm a rule-based travel assistant! Ask me about destinations, budget trips, beaches,
culture, itineraries, food, or safety."
def generate_itinerary(destination, days):
days = int(days)
activities = [
"City Tour", "Museum Visit", "Local Cuisine Tasting", "Beach Day", "Shopping",
"Adventure Sports", "Nature Walk", "Historical Tour", "Cultural Show",
"Boat Ride", "Photography Tour", "Nightlife", "Temple Visit", "Cooking Class",
"Art Gallery Visit", "Traditional Dance Show", "River Cruise", "Theme Park Visit",
"Mountain Hike", "Food Street Tour"
]
[Link](activities)
plan = f"Your {days}-Day Itinerary for {destination}:\n\n"
for i in range(days):
plan += f"Day {i+1}: {activities[i % len(activities)]}\n"
return plan
def estimate_budget(destination, hotel, days, budget):
days = int(days)
budget = int(budget)
hotel_cost = {"5-Star": 200, "4-Star": 150, "3-Star": 100, "Budget": 50}
regional_extra = {"Paris": 70, "Tokyo": 60, "Dubai": 80, "New York": 90}
total = (hotel_cost.get(hotel, 50) + regional_extra.get(destination, 50)) * days
text = f"Estimated Trip Cost:\n- {destination}\n- Hotel: {hotel}\n- Days: {days}\nTotal: ${total}\n"
if total <= budget:
text += "\nYour trip fits within budget!"
else:
text += "\nWarning: Estimated cost exceeds your budget."
return text
def recommend_attractions(destination):
info = destinations_info.get(destination)
places = info["attractions"] if info else fallback_attractions
culture = info["culture"] if info else fallback_culture
return (
f"Top Attractions in {destination}:\n"
+ "\n".join(f"- {p}" for p in places)
+ f"\n\nCulture:\n{culture}"
)
def safety_tips(destination):
return (
f"Safety Tips for {destination}:\n"
"- Keep valuables safe.\n"
"- Avoid isolated areas late at night.\n"
"- Learn basic local phrases.\n"
"- Keep emergency numbers handy.\n"
)
def create_app():
root = [Link]()
[Link]("Tour & Travel Assistant")
[Link]("950x700")
[Link](bg="#000000") # Main black background
title = [Link](root, text="Tour & Travel Services", font=("Helvetica", 26, "bold"),
fg="#FFFFFF", bg="#000000")
[Link](pady=20)
main_frame = [Link](root, bg="#000000")
main_frame.pack(fill="both", expand=True, padx=20, pady=10)
# -------- Left Frame: Form --------
form_frame = [Link](main_frame, bg="#000000")
form_frame.pack(side="left", fill="y", padx=10)
def make_label_entry(text, parent, width=30):
[Link](parent, text=text, font=("Helvetica", 12), fg="#FFFFFF",
bg="#000000").pack(anchor="w", pady=(10,0))
entry = [Link](parent, width=width, font=("Helvetica", 12), bg="#222222", fg="#FFFFFF",
insertbackground="#FFFFFF")
[Link](pady=5)
return entry
name_entry = make_label_entry("Name:", form_frame)
phone_entry = make_label_entry("10-digit Phone Number:", form_frame)
duration_entry = make_label_entry("Duration (1–50 days):", form_frame)
budget_entry = make_label_entry("Budget (USD):", form_frame)
[Link](form_frame, text="Destination:", font=("Helvetica", 12), fg="#FFFFFF",
bg="#000000").pack(anchor="w", pady=(10,0))
destination_box = [Link](form_frame, values=destinations, state="readonly",
font=("Helvetica", 12), width=28)
destination_box.pack(pady=5)
[Link](form_frame, text="Hotel Type:", font=("Helvetica", 12), fg="#FFFFFF",
bg="#000000").pack(anchor="w", pady=(10,0))
hotel_box = [Link](form_frame, values=["5-Star", "4-Star", "3-Star", "Budget"],
state="readonly", font=("Helvetica", 12), width=28)
hotel_box.pack(pady=5)
# -------- Right Frame: AI Output --------
output_frame = [Link](main_frame, bg="#000000")
output_frame.pack(side="left", fill="both", expand=True, padx=10)
ai_output = [Link](output_frame, height=30, width=65, wrap="word", font=("Helvetica", 12),
bg="#1a1a1a", fg="#FFFFFF", insertbackground="#FFFFFF")
ai_output.pack(side="left", fill="both", expand=True)
scrollbar = [Link](output_frame, command=ai_output.yview)
[Link](side="right", fill="y")
ai_output.config(yscrollcommand=[Link])
# -------- Button Frame --------
button_frame = [Link](root, bg="#000000", pady=15)
button_frame.pack(fill="x")
def open_chatbot():
chat = [Link](root)
[Link]("Travel Chatbot")
[Link]("450x550")
[Link](bg="#111111")
[Link](chat, text="Travel Chatbot", font=("Helvetica", 16, "bold"), fg="#FFFFFF",
bg="#111111").pack(pady=10)
chat_frame = [Link](chat)
chat_frame.pack()
chat_box = [Link](chat_frame, height=25, width=55, wrap="word", state="disabled",
font=("Helvetica", 12), bg="#222222", fg="#FFFFFF", insertbackground="#FFFFFF")
chat_box.pack(side="left")
scroll = [Link](chat_frame, command=chat_box.yview)
[Link](side="right", fill="y")
chat_box.config(yscrollcommand=[Link])
user_entry = [Link](chat, width=40, font=("Helvetica", 12), bg="#222222", fg="#FFFFFF",
insertbackground="#FFFFFF")
user_entry.pack(pady=10)
def send_msg():
user = user_entry.get()
if not user:
return
chat_box.config(state="normal")
chat_box.insert("end", f"You: {user}\n")
reply = chatbot_response(user)
chat_box.insert("end", f"Bot: {reply}\n\n")
chat_box.config(state="disabled")
chat_box.see("end")
user_entry.delete(0, [Link])
[Link](chat, text="Send", font=("Helvetica", 12), bg="#555555", fg="#FFFFFF",
width=12, activebackground="#777777", command=send_msg).pack()
def generate_response():
name = name_entry.get().strip()
phone = phone_entry.get().strip()
destination = destination_box.get()
duration = duration_entry.get().strip()
hotel = hotel_box.get()
budget = budget_entry.get().strip()
if not all([name, phone, destination, duration, hotel, budget]):
[Link]("Error", "All fields are required!")
return
if not [Link]() or len(phone) != 10:
[Link]("Error", "Phone must be 10 digits!")
return
if not [Link]() or not (1 <= int(duration) <= 50):
[Link]("Error", "Duration must be 1–50!")
return
if not [Link]():
[Link]("Error", "Budget must be numeric!")
return
with open(CSV_FILE, "a", newline="") as f:
writer = [Link](f)
[Link]([name, phone, destination, duration, hotel, budget])
output = (
"--- AI Travel Plan ---\n\n"
+ generate_itinerary(destination, duration)
+ "\n"
+ estimate_budget(destination, hotel, duration, budget)
+ "\n\n"
+ recommend_attractions(destination)
+ "\n\n"
+ safety_tips(destination)
)
ai_output.delete("1.0", [Link])
ai_output.insert([Link], output)
[Link]("Success", "Plan generated & saved!")
# Modern grey buttons
generate_btn = [Link](button_frame, text="Generate AI Response", font=("Helvetica", 14),
bg="#444444", fg="#FFFFFF", width=25, activebackground="#666666",
command=generate_response)
generate_btn.pack(side="left", padx=20)
chatbot_btn = [Link](button_frame, text="Open Chatbot", font=("Helvetica", 14),
bg="#444444", fg="#FFFFFF", width=20, activebackground="#666666",
command=open_chatbot)
chatbot_btn.pack(side="left", padx=20)
[Link]()
create_app()