I keep getting an error
When I execute this script,
What I want here is
If the SearchingForSpace() function has been called before FinallyReserveParkingBySubmitButton()
It should change the value of the globally declared variable (YesAvailable) to "YES"
Otherwise,
YesAvailable Should stay as "NO"
Quote:if ((YesAvailable == "True") and (len(str(FullNameEntry.get())) > 3) and (
NameError: name 'YesAvailable' is not defined
When I execute this script,
What I want here is
If the SearchingForSpace() function has been called before FinallyReserveParkingBySubmitButton()
It should change the value of the globally declared variable (YesAvailable) to "YES"
Otherwise,
YesAvailable Should stay as "NO"
ParkingPlaceInfo= "0"
YesAvailable = "NO"
def SearchingForSpace():
DestinationName = VariableForDestination.get()
CarType = VariableForCars.get()
for i in PlacesWithParkingSpaces:
if (DestinationName == i):
for j in PlacesWithParkingSpaces[i]:
if (CarType == j):
for k in PlacesWithParkingSpaces[i][j]:
if PlacesWithParkingSpaces[i][j][k] == 1:
BookedOrNotBooked.config(text="Yes! Place Is Available")
global YesAvailable
YesAvailable="YES"
break
else:
BookedOrNotBooked.config(text="Pre-Booked.Choose Another Destination\Car Make")
def FinallyReservingParkingBySubmitButton():
global YesAvailable
if ((YesAvailable == "YES") and (len(str(FullNameEntry.get())) > 3) and (
len(str(CarLicensePlateNoEntry.get())) > 3) and (len(str(EmailAddressEntry.get())) > 3) and (
len(str(PhoneNumberEntry.get())) > 3) and (len(str(DateEntry.get())) > 3) and (len(str(NoOfParkingSpaces.get())) >= 1)):
result = messagebox.askquestion("Book Now",
"Are You Sure You Want To Book This?(Once Booked, It can not be cancelled)",
icon='warning')
