Learn Before
Concept
Creating a simple window with Python Tkinter library
First import the tkinter library
import tkinter as tk
We create an empty window by creating an instance of the Tk class
window = tk.Tk();
Add a title to the window using the .title method
window.title("1Cademy")
We can now add a label inside the window
greeting = tk.Label(text="Hello, World") greeting.pack()
Finally we add window.mainloop() to start an event listener . This method listens for any events like button clicks.
window.mainloop()
After running these code a simple window will be created:

0
1
Updated 2021-08-17
Tags
Python Programming Language
Data Science