from re import I
from easygui import *
import reservationhold
list = []
reserv_made = []
choices2 = ["Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday"]
times1 = ["09:00 - 10:00",
"10:00 - 11:00",
"11:00 - 12:00",
"12:00 - 13:00",
"13:00 - 14:00",
"14:00 - 15:00",
"15:00 - 16:00",
"16:00 - 17:00"]
times2 = ["09:00 - 10:00",
"10:00 - 11:00",
"11:00 - 12:00",
"12:00 - 13:00",
"13:00 - 14:00",
"14:00 - 15:00",
"15:00 - 16:00",
"16:00 - 17:00"]
times3 = ["09:00 - 10:00",
"10:00 - 11:00",
"11:00 - 12:00",
"12:00 - 13:00",
"13:00 - 14:00",
"14:00 - 15:00",
"15:00 - 16:00",
"16:00 - 17:00"]
text = "Hello! What would you like to do today?"
title = "Main Screen"
option1 = ["Make A Reservation", "Cancel A Reservation", "See Reservations"]
choice = choicebox(text,title,option1)
if choice == option1[0]:
text = "Which Conference Room would you like to make a reservation for? Please select one of the following options:"
title = "Conference room reservation"
choices1 = ["Conference Room 1", "Conference Room 2", "Conference Room 3"]
choice = choicebox(text, title, choices1)
list += ({choice})
#-----Conference room 1-----#
if choice == choices1[0]:
text = "Which day you like to reserve the conference room for?"
title = "Conference room reservation"
message = "Selected items : " + str(choice)
day1 = choicebox(message, text, choices2)
list += ({day1})
day1 == choices2[1]
text = "What time you want to reserve the room for?"
title = "Time selection"
time1 = choicebox(text, title, times1)
list += ({time1})
with open('reservationhold.py','a') as f:
f.write(f"{list}" + "\n")
elif choice == option1[1]:
room = "Conference Room 1"
reserv_made += ({room})
day = "Monday"
reserv_made += ({day})
time = "09:00 - 10:00"
reserv_made += ({time})
print(reserv_made)
with open("reservationhold.py", "r+") as f:
data = f.readlines()
with open("reservationhold.py", "w") as f:
for line in data:
if line.strip("\n") == reserv_made:
f.write(data)
# f.seek(0)
# for i in data:
# if i == reserv_made :
# f.write(i)
Hi everyone! I am fairly new to python and wanted to ask a question. I'm trying to make a reservation system in python with easygui as graphical interface. What this program does is make a reservation and stores it in a different python file that is named reservationhold. I am trying to make a cancel service that removes that specific line from the reservationhold file but it deletes everything in the file with the code that i have. I just want to remove a specific line from the other file and not everything. Any help would be appreciated !