Issue 31414: IDLE: Entry tests should delete before insert. (original) (raw)

Test_configdialog 'tests' several integer entry widgets by inserting a digit and then checking that the new value was sent to changes. However, users may delete an entry totally and enter a new value. If we associate an IntVar with the entry widget, int('') is called somewhere in the process, which raises. (IntVar(root).set('') does not, so the error is somewhere further along. The test should imitate users by delete and insert.

Note: a deeper problem is attaching a tracer that get called with each keystroke. Using a StringVar avoids the error when the entry is blanked, but currently allows non-ints to be saved. A better solution would be to not do the auto tracing, but use a IntVar and only call var_changed when the user 'leaves' the box, after checking for a count in a sane range.