Marc Leese
Marc Leese

Reputation: 31

trying to convert this file to python 3 and getting the error module not found

I'm using the solitaire.py file and trying to convert it to Python 3. It was originally 2.7 and works fine in that version but need it in 3 so I can make an AI with PyTorch to play it but I'm having an issue where:

from Canvas import Rectangle, CanvasText, Group, Window

shows the error:

ModuleNotFoundError: No module named 'Canvas'

Does anyone have any idea as to why or if there is something similar I could use in python 3 to make it work?

Upvotes: 0

Views: 823

Answers (1)

MyNameIsCaleb
MyNameIsCaleb

Reputation: 4489

Canvas was deprecated in Python 3.

Instead you can use tkinter by doing: [docs]

from tkinter import Canvas

Or do this:

from tkinter import *

Upvotes: 1

Related Questions