Let's learn the basics of Tkinter by creating a simple Hello World script for Tkinter by performing the following steps:
- Create a new file in IDLE or your favorite editor, enter the following code, and save it as hello_tkinter.py:
"""Hello World application for Tkinter""" from tkinter import * from tkinter.ttk import * root = Tk() label = Label(root, text="Hello World") label.pack() root.mainloop()
- Run this in IDLE by hitting F5 or in your terminal by typing the following command:
python3 hello_tkinter.py
You should see a very tiny window pop up with the text Hello World as shown in the following screenshot:
- Close the window and return to your editor screen. Let's break down this code and talk about what ...