Basics
Basics
PYTHON PROGRAMMING
2
Building Your First Python GUI Application
With Tkinter
The foundational element of a Tkinter GUI is the window. Windows are the containers in
which all other GUI elements live. These other GUI elements, such as text boxes, labels,
and buttons, are known as widgets. Widgets are contained inside of windows.
First, create a window that contains a single widget. Start up a new Python shell session
and follow along!
3
Building Your First Python GUI Application
With Tkinter
With your Python shell open, the first thing you need to do is import the Python GUI
Tkinter module:
>>> import tkinter as tk
A window is an instance of Tkinter’s Tk class. Go ahead and create a new window and
assign it to the variable window:
>>> window = tk.Tk()
When you execute the above code, a new window pops up on your screen. How it looks
depends on your operating system:
4
Building Your First Python GUI Application
With Tkinter
5
6
7
8
9
10
References
1. https://www.cs.mcgill.ca/~hv/classes/MS/TkinterPres/#WhatIsTk
2. https://www.tutorialspoint.com/how-to-install-tkinter-in-python
3. https://www.python.org/about/gettingstarted/
4. https://www.javatpoint.com/python-tutorial
5. https://www.learnpython.org/
11
THANK YOU
12