Sam Brown Sam Brown - 5 months ago 8
Python Question

How to create a window on Python 2?

I've been researching and I can't find anything. I tried this code:

import sys
from tkinter import *
App = Tk()
App.geometry("600x400")
App.mainloop()


But I get back:

Traceback (most recent call last):
File "I:/Files/Documents/Python/Creating a window.py", line 2, in <module>
from tkinter import *
ImportError: No module named tkinter

Answer

If you already installed tkinter, try below code.

Update:

In Python2:

from Tkinter import *  

In Python3:

from tkinter import *