Let’s Understand the Basics
Firstly Tkinter is a module that is available in most IDE’s. So let’s break apart the beginning into points:
- Importing the Tkinter module.
- Creating a window in which the program executes. It is also known as the “root window”.
- Finally, using a function to execute the code which is known as “mainloop()”.
Python3
# import all things from tkinter from tkinter import * # create root window root = Tk() # widgets,buttons,etc here root.mainloop() |
Output:
This is how you could build a window in just three simple lines!
Note: Please do not spell “tkinter” as with a capital “T”, as this would not import the module and you would most probably encounter an error message!!!
Build a basic Text Editor using Tkinter in Python
Tkinter is a Python Package for creating GUI applications. Python has a lot of GUI frameworks, but this is the only framework that’s built into the Python standard library. It has several strengths; it’s cross-platform, so the same code works on Windows, macOS, and Linux. It is lightweight and relatively painless to use compared to other frameworks. This makes it a compelling choice for building GUI applications in Python, especially for applications where a modern shine is unnecessary, and the top priority is to build something that’s functional and cross-platform quickly.
Let’s start quickly working with Tkinter