0

For an assignment, I have to create a turtle program on python which uses recursion to draw a shape.

However, I am unable to even create the necessary screen to draw any shapes on. I am currently using Google Collab.

import turtle

t = turtle.Turtle()

Is what my program looks like right now, I have turtle installed and I have searched everywhere for alternate solutions to creating a screen but every line I have found more or less has the same line, which doesn't work for me.

Any ideas on how to fix this?

PersianMan
  • 924
  • 1
  • 12
  • 29
niconico
  • 9
  • 2
  • did you find [using-turtle-graphics-in-google-colab](https://stackoverflow.com/questions/56876886/using-turtle-graphics-in-google-colab) and did it help? – Patrick Artner Oct 29 '21 at 07:26
  • https://www.linuxtut.com/en/e0039b79619306f63bf0/ , https://www.youtube.com/watch?v=5IHp1peG-xM , https://colab.research.google.com/github/karinjd/CSCI5525/blob/master/Turtle.ipynb - plenty of resources on good old google: `python turtle google colab example` as search keys... did you check them? did they help? – Patrick Artner Oct 29 '21 at 07:27
  • If nothing of the above helped, [mre] + stacktrace and/or better error description – Patrick Artner Oct 29 '21 at 07:29
  • 1
    Thank you Patrick Artner, I watched one of the youtube videos that you tagged and it helped alot!! I was able to generate a screen :) – niconico Oct 29 '21 at 07:34
  • Here is my ColabTurtle notebook. Hope it will help. https://colab.research.google.com/drive/1KMk72MX5igJiWGEZkIdvEzIZ7kg-hPo9 – nov05 Mar 13 '23 at 17:54

1 Answers1

0

You are using collab. Collab does not work with turtle unless you have an environment. I suggest PyCharm or the built - in python editor IDLE. Also, you forgot to make a screen. Make the screen under the import.

screen = turtle.screen()

Then, if you are using PyCharm, type this at the end of your program.

screen.exitonclick()
Dharman
  • 30,962
  • 25
  • 85
  • 135
Walt
  • 7
  • 5