0

I am learning OPP and the tutorial I am following is tinkering with the Turtle Module, however when I run this basic code:

from turtle import Turtle
from turtle import Screen


timmy = Turtle()
print(timmy)
timmy.shape("turtle")
timmy.color("red","green")

my_screen = Screen()
print(my_screen.canvheight)
my_screen.exitonclick()

I get this error:

/usr/local/bin/python3.11 /Users/salaheddinefathallah/Files of Salah/Programming/01. Python/03. App Brewery/147 - First OPP Project/main.py 
Traceback (most recent call last):
  File "/Users/salaheddinefathallah/Files of Salah/Programming/01. Python/03. App Brewery/147 - First OPP Project/main.py", line 1, in <module>
    from turtle import Turtle
  File "/usr/local/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/turtle.py", line 107, in <module>
    import tkinter as TK
  File "/usr/local/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/tkinter/__init__.py", line 38, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
    ^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named '_tkinter'

Process finished with exit code 1

What's the issue?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
Salah
  • 9
  • 3
  • 1
    Does this answer your question? [ImportError: No module named 'Tkinter'](https://stackoverflow.com/questions/25905540/importerror-no-module-named-tkinter) – mkrieger1 May 27 '23 at 14:04
  • Have you tried installing *tkinter*(`pip install tk-tools`) like it says? (I hope you are not using an older version of turtle which uses an outdated version of tkinter or something as its says '**_tkinter** with an underscore') – Broteen Das May 27 '23 at 14:04

0 Answers0