Validating user input

Let's discuss input data validation in Tkinter.

Most of the applications that we have developed in our book are point-and-click-based (the drum machine, the chess game, and the drawing application), where a validation of user input is not required. However, data validation is a must in programs such as the phone book application, where a user enters some data and we store it in a database.

Ignoring user input validation can be dangerous in such applications because input data can be misused for SQL injection. In general, an application in which a user can enter textual data is a good candidate for the validation of user input. In fact, not trusting user inputs is almost considered a maxim.

Wrong user inputs may be intentional ...

Get Tkinter GUI Application Development Blueprints - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.