python - Validate tkinter user input, presence check -
i need validate user inputs on tkinter gui. need have presence check, format check(a date) , 1 of inputs can 1 of 3 options , not sure how these. have looked @ other examples hard understand because have not been using classes. know how this?
here example code
entry1= entry(window, bg="blue", fg="white",font="40") entry2= entry(window, bg="blue", fg="white",font="40") entry3= entry(winodw, bg="blue", fg="white",font="40") #assigning input boxes area on screen entry1.grid(row=1, column=1) entry2.grid(row=2, column=1) entry3.grid(row=3, column=1) forename=entry1.get() surname=entry2.get() dateofbirth=entry3.get()
you need validate function checks string variable of 3 entry fields, ie:
def validate(): if forename == valid_forename: print 'valid forename' else: print '%s not valid forename' % forename and can call button:
vbutton = button(window, text='validate', command=validate) vbutton.grid() your 3 types of 'checks' go validate() function. should able accomplish these simple value checking, if can't, should post specific question type of value checking can't work , tried make work.
Comments
Post a Comment