

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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.
Example
# 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()
Output
Executing the above code will display a new window with some text message in it.
- Related Questions & Answers
- How do I change the overall theme of a tkinter application?
- What permission do I need to access Internet from an Android application?
- When do we need Continuous Compounding?
- Why do I need Babel JS?
- 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
- Do I need to import the Java.lang package anytime during running a program?
- How do I close a tkinter window?
- How to call the main function in C program?
- How do I get an event callback when a Tkinter Entry widget is modified?
- Do I need to use a semicolon after every function in JavaScript?
- How do I bind the enter key to a function in Tkinter?
- How do I position the buttons on a Tkinter window?
- How do I change the background of a Frame in Tkinter?
- How do I center the text in a Tkinter Text widget?
Advertisements