Steve
Steve

Reputation: 27

Unable to call Tkinter module in Python2.7 for some reason

I am unable to call Tkinter from text editor(sublime) OR interpreter..

I did a fresh Debian install on Virtualbox with ActivePython2.7

Here is a video on 1.5min for easier explanation on my problem!

Thanks for your time, guys!

https://www.youtube.com/watch?v=eIj3KuzaNpM

Upvotes: 1

Views: 193

Answers (2)

xor
xor

Reputation: 2698

For python2.x it is:

from Tkinter import *

For python3.x it is:

from tkinter import *

Now as you are using python 2.7 you should be using from Tkinter import *

However it would be better to use:

import sys
if sys.version_info[0]==2:
    from Tkinter import *
if sys.version_info[0]==3:
    from tkinter import *

in order to avoid any future problem

Upvotes: 0

Cassum
Cassum

Reputation: 329

I guess this can help you:

>>> import tkinter
Traceback (most recent call last):
  File "<ipython-input-2-b98d59735c04>", line 1, in <module>
    import tkinter
ImportError: No module named tkinter

>>> import Tkinter
>>> 

Upvotes: 1

Related Questions