0

I am trying to create a simple gui and run in IDLE but every time I run it , it gives me the error :Import Error: No module named 'Tkinter'

This is my code if anybody is wondering:

from Tkinter import *
root = Tk()
root.mainloop()

I have also tried to verify if i have installed tkinter or not with command import tkinter and tkinter._test() and it shows that I have tkinter installed.

DYZ
  • 51,549
  • 10
  • 60
  • 87
Explosion
  • 47
  • 1
  • 3
  • 12
  • Compare what you've said with your actual code... `import tkinter` is not what you're running, or what module the error says is missing – OneCricketeer Aug 26 '17 at 05:55

1 Answers1

3

Use lowercase T for tkinter import statement for Python 3 :

import tkinter

IF your using python2 it's:

from Tkinter import *

But your using python3, so it's:

from tkinter import *
Taufiq Rahman
  • 5,436
  • 2
  • 35
  • 43
  • using all lowercase works but i had seen a code on the internet having the 'T' capital and it worked. Thanks for the answer. – Explosion Aug 26 '17 at 05:55
  • That is Python 2 version of the module. You are using Python 3 and on python 3 the module name is tkinter. – Taufiq Rahman Aug 26 '17 at 05:57