I'm making a small program for learning purposes. The user is asked to input numbers into a few entry boxes, but I would like for the program to give focus to the box that does not contain an appropriate value. I already have it print an error message to the user from ValueError, but this is just in the event that any of the boxes does not contain an appropriate number (I used an if statement to check for entry boxes that contain a 0 or negative when they should only have a positive number since those would not be caught by ValueError). So after it prints the error message I want it to figure out which box is the problem and give that box focus. I found a suggestion for using
which works if the box is empty, but does not work if the box contains a non-number (though it still prints the error message). Ideas on how to get around this?
An earlier iteration of the program is already posted
here