0

Is there a possibility to set a max value for a data entry? For example: Max value = 350, someone enters 400, the value automatically chances to 350.

I thought something like

if int(entry1.get()) > 350:
    int(entry1) = 350

But I can’t get this to work because of an int error.

Thanks in advance.

Delrius Euphoria
  • 14,910
  • 3
  • 15
  • 46
  • 1
    You should put this inside of a function and then use binding or trace it with `IntVar()` or by using `after()` – Delrius Euphoria Sep 29 '20 at 06:36
  • 1
    This also can be done without validation, indeed a much easier way, voting to reopen the Q – Delrius Euphoria Sep 29 '20 at 06:40
  • @CoolCloud - The linked duplicate (along with many others) asks the same question at hand. If you have a new answer for that question that hasn't been posted yet, _answer that question_ rather than reopening a duplicate and fragmenting the information. – TigerhawkT3 Sep 29 '20 at 07:21
  • 1
    @TigerhawkT3 This Q has been edited and no more asks for validation. I voted to reopen the Q because here there is no need for such validations at all, and cant just expect people to understand that. – Delrius Euphoria Sep 29 '20 at 07:28
  • If I understand validation correctly it only indicates whether it is true or flase. And i need to change the value when it above max to the max value? I dont get why its a duplicate Q. – Evan Haasjes Sep 29 '20 at 08:46
  • If you dont mind, delete this Q and ask a new Q, ill answer there – Delrius Euphoria Sep 29 '20 at 09:02

0 Answers0