Nov-17-2021, 02:16 PM
Thanks but I stumbled on a solution that works. Rather than register the validation routine I simply use the validation as a command on the button:
submitButton=tk.Button(top,text='Submit',command=validatePhone)Thus the only time I try to validate is when the submit button is clicked. My validate probably does not need everything I am doing in it but it helps for debugging.
def validatePhone(): num=phone.get() print(num) pattern=re.compile('\d{3}-\d{3}-\d{4}') if (pattern.search(num)): print('true') top.quit() else: phone.configure(background='Red') print('false') return(pattern.search(num))When 'top.quit' is called it lets the script proceed with processing the tkinter data.