Using Module tkinter
Every tkinter program consists of these things:
-
Windows, buttons, scrollbars, text areas, and other widgets—anything that you can see on the computer screen. (Generally, the term widget means any useful object; in programming, it is short for “window gadget.”)
-
Modules, functions, and classes that manage the data that is being shown in the GUI—you are familiar with these; they are the tools you’ve seen so far in this book.
-
An event manager that listens for events such as mouse clicks and keystrokes and reacts to these events by calling event handler functions.
Here is a small but complete tkinter program:
| | import tkinter |
| | window = tkinter.Tk() |
| | window.mainloop() |
Tk is a class that represents the root window
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access