Question: I am creating a python tkiner app and setting my entry fields I have created an only letters function on my order class and I
I am creating a python tkiner app and setting my entry fields I have created an only letters function on my order class and I have it to set the length to greater than not blank for all entry fields name address, etc however, I am trying to set the state to only accept letters. I can get it to not accept lower than two but if i was to type out the state name it would still accept it How do i modify the code to only allow letters for the state entry but allow over for the other entry fields?
Code snipted
def onlylettersinputtext, length:
only letters function will validate input to ensure each only contains letters and is the
not blank"""
# reviewing all letter only input fields to ensure they do not include numbers and are not blank
return inputtext.isalpha and leninputtext length.
def receipt :
cardholderlastname cardholderlnameentry.get
# validating entry to be letters and not blank
if not onlyletterscardholderlastname, :
messagebox.showerrorError "The card holder's last name can only contain letters and
"cannot be blank!
return
# creating an address variable
caddress address.get
# validating entry to be letters and numbers and not blank
if caddress :
messagebox.showerrorError "Cardholder address must contain a valid street address
"and cannot be blank!"
return
# creating city variable
city cityentry.get
# validating entry to be letters and not blank
if not onlyletterscity:
messagebox.showerrorError "Your city can only contain letters and cannot be blank!
return
# creating state variable
state stateentry.get
# validating entry to be letters and to be at least characters
if not onlylettersstate:
messagebox.showerrorError "Your state must be the two letter abbreviation or spelled
"out without spaces and it cannot be blank!"
return
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
