Python Tkinter is a standard library that is used to develop GUI-based featured and functional applications. Whenever we execute our application, it displays a general window that contains some widgets and a title bar in it. The mainloop() method is responsible for executing the script and displaying the output window. However, mainloop() implies that it doesn't terminate automatically until the user remains in the window. Whenever the user terminates the program, it gets closed automatically. The mainloop() method gets called whenever the program starts executing.
# Import the required libraries from tkinter import * # Create an instance of tkinter frame win = Tk() win.geometry("700x350") # Add a Label widget Label(win, text="This is a New Line Text", font= ('Times New Roman', 18,'bold')).pack(pady= 40) win.mainloop()
Executing the above code will display a new window with some text message in it.