Sam Brown Sam Brown - 1 year ago 95
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()

But I get back:

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

Answer Source

If you already installed tkinter, try below code.


In Python2:

from Tkinter import *  

In Python3:

from tkinter import *
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download