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() win.mainloop()
Here is the output for the above program.
Additional ways to show a window in Python
from tkinter import * root = Tk() root.mainloop()
If you have any questions or comments, then send us an email at email@example.com.
Click on the button below to go to our Python page.
Python is a high-level computer programming language. If you want more information on Python, then visit Python Software Foundation.