in reply to Entry Widget - validatecommand

Quoting the documentation:
In general, the textVariable and validateCommand can be dangerous to mix.
Also, you probably should only run the validation on lost focus (otherwise, negative integers cannot be entered from the beginning), i.e. change 'key' to 'focusout'.