When I answer Tkinter questions I usually try and run the code myself, but sometimes I get this error:
Traceback (most recent call last):
File "C:\Python27\pygame2.py", line 1, in <module>
from tkinter import *
ImportError: No module named tkinter
When I look at the question I see they import tkinter
with a lower-case t:
from tkinter import *
I always import Tkinter
with a capital T:
from Tkinter import *
Which always works for me. What is the difference between using tkinter
and Tkinter
?
Please use this question as the canonical to close questions where OP has used the wrong name for the import. There are other reasons why importing the Tkinter library may fail; see also Why does tkinter (or turtle) seem to be missing or broken? Shouldn't it be part of the standard library? , a newly established canonical to gather information about those problems and how to repair the Tkinter installation when necessary. If it isn't clear which case applies, please either offer both duplicate links, or close the question as "needs debugging details".