April 2018
Beginner
340 pages
7h 54m
English
Now that we have the basic understanding of the concept of widgets and how to add them into a window, it's time to put this into practice and make ourselves an application!
As with almost all programming examples, we will start with a Hello World application. Don't feel cheated though, it will have interactive aspects too! Let's begin with the most important step for any GUI application—showing a window. Start by opening your choice of text editor or IDE and putting in the following code:
import tkinter as tkclass Window(tk.Tk): def __init__(self): super().__init__() self.title("Hello Tkinter") label = tk.Label(self, text="Hello World!") label.pack(fill=tk.BOTH, expand=1, padx=100, pady=50)if __name__ == "__main__": window = ...