-1

I am working on Python v2.x windows os. I notice tcl (including TKinter) IS installed while I am having Python installed.

But when I verify it by typing 'import tkinter' on Python IDLE, there is error: "ImportError: No module named tkinter"

Could anyone give me some advice? Thanks.

Amber.G
  • 1,103
  • 5
  • 11
  • 15

2 Answers2

1

In Python2,

import Tkinter

In Python3

import tkinter
unutbu
  • 777,569
  • 165
  • 1,697
  • 1,613
1

Python 2.x use Tkinter - see upper T.

In Python 3.x name was changed to tkinter

To work with both Pythons you can use

try:
    import Tkinter as tk
except ImportError:
    import tkinter as tk


root = tk.Tk()
Chris
  • 112,704
  • 77
  • 249
  • 231
furas
  • 119,752
  • 10
  • 94
  • 135