How it works...
In line 10 of the preceding code, we import a separate module from the tkinter package. The ttk module has some advanced widgets that make our GUI look great. In a sense, ttk is an extension within the tkinter package.
We still need to import the tkinter package itself, but we have to specify that we now want to also use ttk from the tkinter package.
Line 19 adds the label to the GUI, just before we call mainloop .
We pass our window instance into the ttk.Label constructor and set the text property. This becomes the text our Label will display.
We also make use of the grid layout manager, which we'll explore in much more depth in Chapter 2, Layout Management.
Note how our GUI suddenly got much smaller than in the previous recipes.
The reason why it became so small is that we added a widget to our form. Without a widget, the tkinter package uses a default size. Adding a widget causes optimization, which generally means using as little space as necessary to display the widget(s).
If we make the text of the label longer, the GUI will expand automatically. We will cover this automatic form size adjustment in a later recipe in Chapter 2, Layout Management.