Search code examples
pythontkinterboundary

A Tkinter Entry with boundaries


Currently, I am working on a Tkinter GUI. In this GUI, I would like to include an Entry field where users can only enter numbers between two boundaries (for instance, a number between 0.0 and 200.0). I have looked into the validatecommand option, but this still does not provide me a solution. Is there somebody who can help me to create a Tkinter Entry with boundaries?

Thank you in advance.


Solution

  • You can get the value by .get() method and then write an if statement to generate an error or reset the value by .set() method when limits are exceeded.