- Trending Categories
- Data Structure
- Operating System
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
When do I need to call the main loop in a Tkinter application?
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.
- Related Articles
- How do I change the overall theme of a tkinter application?
- What permission do I need to access Internet from an Android application?
- How do I make a pop-up in Tkinter when a button is clicked?
- Call the same function when clicking a Button and pressing Enter in Tkinter
- When do we need Continuous Compounding?
- How to call the main function in C program?
- How do I bind the enter key to a function in Tkinter?
- How do I get an event callback when a Tkinter Entry widget is modified?
- Why do I need Babel JS?
- How Many Exercises Do I Need?
- How do I close a tkinter window?
- How to set the tab order in a Tkinter application?
- How do you create a Tkinter GUI stop button to break an infinite loop?
- Do I need to import the Java.lang package anytime during running a program?