pythongoogle-colaboratoryturtle-graphics

How do you use ColabTurtle?


Although I know I can install ColabTurtle to use Turtle on a Colab Notebook, I cannot figure out how. Could someone please give me an example on how to run Turtle codes on Colab?


Solution

  • Here is an example notebook.

    First, you need to install it.

    !pip install ColabTurtle
    

    Then import all functions and init it.

    from ColabTurtle.Turtle import *
    initializeTurtle()
    

    Then call normal turtle commands, e.g.

    forward(100)
    right(90)
    forward(100)
    right(90)
    forward(100)
    

    You can see all supported commands in the code.