0

So I tried to make a turtle subclass:

from turtle import Turtle, Screen
class EngineScreen(Screen):
    def __init__(self):
        Screen.__init__(self)

and when I runned the code, I got this error: TypeError: function() argument 'code' must be code, not str

I tried changing it to a Rawturtle subclass and it worked, but I need the inherited TurtleScreen methods for the other function to work.

  • What are you trying to do that requires subclassing? I'd use [composition ("has-a"), not inheritance ("is-a")](https://stackoverflow.com/a/71003069/6243352) when using Python turtle. – ggorlen Aug 13 '23 at 15:17

0 Answers0