Can't import tkinter

0 votes
I am using Python 2.7 for my project and I am trying to import Tkinter. But I get the following error:

ImportError: No module named tkinter

I have tried both "Tkinter" and "tkinter" but have gotten the exact same message. Can anyone help me fix this issue?
May 21 in Python by ana1504.k
• 7,890 points
108 views

1 answer to this question.

0 votes
You can Try this code to import Tkinter:

try:
    import Tkinter as tk # this is for python2
except:
    import tkinter as tk # this is for python3
answered May 21 by SDeb
• 13,210 points

Related Questions In Python

0 votes
1 answer

TkInter Grid Overlapping Issue

Tkinter is fairly efficient. And for the ...READ MORE

answered Apr 17, 2018 in Python by anonymous
715 views
0 votes
1 answer

How to import other Python files?

importlib is recent addition in Python to ...READ MORE

answered Jul 27, 2018 in Python by Priyaj
• 56,960 points
69 views
0 votes
1 answer

Need help with Tkinter window formatting using Python

Tkininter comes with the columnspan argument to span the labels ...READ MORE

answered Sep 7, 2018 in Python by ariaholic
• 7,340 points
50 views
0 votes
1 answer

Is there a way of using .lower more effectively in tkinter?

Here is a simple function and some ...READ MORE

answered Sep 25, 2018 in Python by Priyaj
• 56,960 points
185 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 405 views
0 votes
2 answers

Removing Title bar in Tkinter program

you can remove the title bar by ...READ MORE

answered Mar 19 in Python by anonymous
2,194 views
0 votes
1 answer

Can't pickle defaultdict

A module-level function is a function which ...READ MORE

answered Apr 8 in Python by SDeb
• 13,210 points
147 views