Module named 'Tkinter' not found - python

Asked

Viewed 82 times

0

I started messing around in the library tkinter python recently, but I can’t because the library is not found.

The error message shown is as follows: ModuleNotFoundError: No module named 'tkinter'. I have tried to rename Tkinter, manually install the library through sudo apt-get install python3-tk, but still with the same mistake.

I’m using python 3.7 in Pycharm.

Code:

from tkinter import *
class Application:
    def __init__(self, master=None):
        pass
root = Tk()
Application(root)
root.mainloop()

1 answer

0

Tkinter has been since Python 3.1, ttk where they are included in all standard Python distributions. I recommend installing the "Activepython" distribution of Activestate, which includes everything you need.

python -m tkinter ou  python3 -m tkinter

This should appear in a small window; the first line at the top of the window should show the version. inserir a descrição da imagem aqui

Activestate.com

NOTE: in the case python2 the import must be done with Tkinter( T in capital letters)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.