0

I have preconception that 'Tkinter' is module that only for Python 3. When I use Python 2, I thought that I must import as first letter of the words as upper-case letter like this.

import Tkinter 

I expected that when I typed import Tkinter on Python 2.7.15, It would be printed like this

Traceback (most recent call last) : 
     File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tkinter'

But In my python 2.7.15, no traceback, error has been occured.

What is the candidate of this?

DavidS
  • 278
  • 1
  • 17
JongHyeon Yeo
  • 736
  • 7
  • 17
  • 1
    Tkinter does not come with python for any distrobution outside of windows. You need to first `pip install tkinter` on your Ubuntu Python distro. For linux you will probably need to `apt-get` the `pip` module so you can `pip` install libraries such as Tkinter. – Mike - SMT Aug 30 '18 at 11:35

1 Answers1

1

As far as I am aware only the Windows distributions of Python come with Tkinter already in the distro. For Ubuntu you will need to install the distro.

If you do not already have pip installed you can do:

sudo apt-get install python-pip python-dev build-essential 

After that it should be as simple as:

pip install tkinter

There are a few ways to install pip so go to this link for more details if the above doesn't work.

Mike - SMT
  • 15,421
  • 4
  • 34
  • 61