Tkinter to make a window – video 1

Window with tkinter

To make a window with tkinter is very easy. You can see it in this short video that follows here. Just a couple of lines and the window is ready. In the next videos we will go further with the use of this module to make very nice and useful GUI using Python, to make our programs easier to be used, being more intuitive with a graphic interface rather tnat with just a CLI (command line interface).
We will use tkinter, a module that comes in with all the installations of Python (batteries are included), so that is very easy to use, no need to install anything, working on all systems. It’s the best choice to invest in learning it, if you want to use graphic user interface with Python.

# Make a window with

# tkinter

# first import the module (in python 2 will be Tkinter, with capital letter)

import tkinter as tk

# create the istance of the first class

root = tk.Tk()

# give a title and the width and height to the window

root.title("MyApp")

# 400x300 = width and height 100+100 x and y on the screen)

root.geometry("400x300+100+100")

# the following code make a loop that make the window to stay active

root.mainloop()

The music is original, by the author of this article

Tkinter test for students

Tkinter articles

Published by pythonprogramming

Started with basic on the spectrum, loved javascript in the 90ies and python in the 2000, now I am back with python, still making some javascript stuff when needed.