Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Post History

75%
+4 −0
Q&A Why does `tkinter` (or `turtle`, or IDLE) seem to be missing or broken? Isn't it part of the standard library?

I had understood that Python is supposed to come "batteries included", and that the "batteries" specifically include: the tkinter standard library, a simple GUI framework a simple IDE cal...

1 answer  ·  posted 5mo ago by Karl Knechtel‭  ·  last activity 4mo ago by Karl Knechtel‭

#1: Initial revision by user avatar Karl Knechtel‭ · 2024-06-18T10:50:16Z (5 months ago)
Why does `tkinter` (or `turtle`, or IDLE) seem to be missing or broken? Isn't it part of the standard library? 
I had understood that Python is supposed to come "batteries included", and that the "batteries" specifically include:

* the `tkinter` standard library, a simple GUI framework

* a simple IDE called IDLE, implemented using `tkinter`

* the `turtle` standard library, which uses `tkinter` to implement [turtle graphics](https://en.wikipedia.org/wiki/Turtle_graphics) (useful for teaching Python)

However, none of these is working on my system:

```
>>> import tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tkinter'
>>> import turtle
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.8/turtle.py", line 107, in <module>
    import tkinter as TK
ModuleNotFoundError: No module named 'tkinter'
```
and the IDLE program is nowhere to be found.

I've similarly heard that Python compiled from source might give an error like:
```
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/path/to/python/tkinter/__init__.py", line 39, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
```

What gives? I know that these components [are definitely part of the standard library](https://docs.python.org/3/library/tk.html).