Python Forum
[Tkinter] How Does Entry Verification Work?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] How Does Entry Verification Work?
#3
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.
Reply


Messages In This Thread
How Does Entry Verification Work? - by gw1500se - Nov-13-2021, 08:43 PM
RE: How Does Entry Verification Work? - by gw1500se - Nov-17-2021, 02:16 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Transfer Toplevel window entry to root window entry with TKinter HBH 0 4,611 Jan-23-2020, 09:00 PM
Last Post: HBH
  [Tkinter] how to get the entry information using Entry.get() ? SamyPyth 2 3,624 Mar-18-2019, 05:36 PM
Last Post: woooee

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020