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, 2019 in Python by ana1504.k
• 7,890 points
298 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, 2019 by SDeb
• 13,250 points

Related Questions In Python

0 votes
1 answer

Can't import scikit -learn on python3.

Hi@akhtar, First, remove the Sklearn form your Windows system ...READ MORE

answered Jun 22 in Python by MD
• 57,960 points
203 views
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
1,539 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
• 57,660 points
174 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 aryya
• 7,380 points
110 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, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,373 views
0 votes
0 answers
0 votes
2 answers

Removing Title bar in Tkinter program

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

answered Mar 19, 2019 in Python by anonymous
8,044 views
0 votes
1 answer

Can't pickle defaultdict

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

answered Apr 8, 2019 in Python by SDeb
• 13,250 points
469 views