Create a window in Python

The code in this article shows you how to create a window in Python. For the purpose of this example, we did this in Visual Studio Code.

Code listing to create a window in Python

Below is the code listing for this program.

import tkinter as mainWin
win = mainWin.Tk()


Here is the output for the above program.

show window in python - Techronology
Additional ways to show a window in Python
from tkinter import *
root = Tk()

Developer’s note

If you have any questions or comments, then send us an email at

Python page

Click on the button below to go to our Python page.

Python page

Create a menu in Python - Techronology

Python is a high-level computer programming language. If you want more information on Python, then visit Python Software Foundation.

Techronology home  Code library  Reference desk