How to make a tkinter Entry field mandatory to enter some text?
问题 like in HTML tag attribute required=required I want make an Entry widget mandatory, the user must enter data in it, otherwise don't proceed to next step. How to do it with tkinter? 回答1: There is no attribute "required" in Tkinter, you need to write a function to check whether the user entered data in the entry or not. Then use this function as the command of the "Next" button. import tkinter as tk def next_step(): if mandatory_entry.get(): # the user entered data in the mandatory entry: