3

The aforementioned error showed up when I tried to use the Turtle class. I was following a tutorial where it's used to pop up a window in the screen. The code is simple:

from turtle import Turtle, Screen
jabba = Turtle()
print(jabba)

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

But in the terminal it says:

ModuleNotFoundError: No module named 'tkinter'

I'm on Ubuntu 20.04 using PyCharm professional IDE.

BeastOfCaerbannog
  • 12,964
  • 10
  • 49
  • 77
yaa__
  • 645
  • 2
  • 9
  • 22
  • Does this answer your question? [unable to install/import tkinter](https://askubuntu.com/questions/505141/unable-to-install-import-tkinter) – karel Jul 08 '21 at 07:29

2 Answers2

6

Installing python3-tk solved it:

sudo apt-get install python3-tk
BeastOfCaerbannog
  • 12,964
  • 10
  • 49
  • 77
yaa__
  • 645
  • 2
  • 9
  • 22
2

Run this command on terminal

sudo apt-get install python-tk
Muhammad Anas
  • 115
  • 2
  • 8