0

Is there a way to restrict the user to type only integer data, and throw an error if the input is not, in the age entrybox?

Here is the code I'm using:

from tkinter import *

main_window = Tk()
main_window.geometry("500x500")

# Labels
Label(main_window, text= "Whats your age").grid(row=1, column=0)

# Text input
age = Entry(main_window,width=50, borderwidth=5)
age.grid(row=1,column=1)

main_window.mainloop()
Tony
  • 564
  • 5
  • 21
  • The question with the most comprehensive answer is here: https://stackoverflow.com/questions/4140437/interactively-validating-entry-widget-content-in-tkinter – Bryan Oakley Nov 17 '21 at 00:02

0 Answers0