Questions tagged [turtle-graphics]

A method for drawing computer graphics using a cursor, known as a turtle. Turtle-graphics supports game development, visualizations, animation, etc.

A method for drawing graphics, which uses a cursor (known as a turtle) for specifying the position, the direction and the attributes (color, line width, etc.) of the lines being drawn. It was popularized by the Logo programming language. Similar functionality can currently be found in Python's turtle module, which is part of its standard library.

The turtle runs commands sent to it sequentially, including moving forwards or backwards, turning/rotating, and raising or lowering "the pen" determining if the turtle is currently drawing a line while moving. This output pathway of the turtle can additionally be post-processed into 3-dimensional models. Depending upon the implementation, the turtle may traverse 2D, 3D, or N-dimensional coordinate spaces.

3188 questions
11
votes
7 answers

Can't import turtle module in Python 2.x and Python 3.x

I want to play with turtle module in Python. But when i do import turtle module, i've the following error: $ python Python 2.7.3 (default, Sep 26 2012, 21:51:14) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for more…
Mind Mixer
  • 1,503
  • 3
  • 13
  • 15
10
votes
2 answers

AttributeError: partially initialized module 'turtle' has no attribute 'Turtle' (most likely due to a circular import)

Does anybody have any idea why this code doesn't work? import turtle test = turtle.Turtle() test.color("orange") test.pensize(5) test.shape("turtle") test.forward(100) I use python 3.8
Sahil Forough
  • 109
  • 1
  • 1
  • 5
10
votes
3 answers

Make turtle graphics inline

I have been using turtle package in python idle. Now I have switched to using Jupyter notebook. How can I make turtle inline instead of opening a separate graphic screen. I am totally clueless about. Any pointers and advice will be highly…
dearbharat
  • 111
  • 1
  • 1
  • 9
10
votes
6 answers

How to draw a semicircle in Python turtle only

How to draw a semi circle(half circle) in python turtle only? I can only use Python turtle. I have try looking for resouces but no luck on finding ones that only use Python turtle.
BobTheCat
  • 127
  • 2
  • 2
  • 8
10
votes
2 answers

Drawing polygon with n number of sides in Python 3.2

I have to write a program in Python that reads the value n and draws a polygon of n sides on the screen. I can use either the turtle graphics module or graphics.py module. I know how to draw a polygon when n = the number of points you input and…
Goose LaMoose
  • 121
  • 1
  • 2
  • 8
9
votes
1 answer

How can I change the size of my python turtle window?

I am currently trying to draw a Mandelbrot set in python with turtle. However, my problem has nothing to do with the Mandelbrot. I can't change the size of my turtle window. How can I do that? I tried to initialize a screen and set the screen size…
Nils Walker
  • 159
  • 1
  • 1
  • 9
9
votes
1 answer

How to send commands from Python turtle graphics to an EV3 Lego brick?

EDIT FOR T KINTER: IDE is Visual Studio Code Traceback call is printed below scripts TkinterTest.py #!/usr/bin/env python3 from tkinter import * from tkinter import ttk import Ev3_Motor ev3 = Ev3_Motor.Ev3_Motor() def calculate(*args): …
shecodesthings
  • 1,218
  • 2
  • 15
  • 33
9
votes
1 answer

Is there a complete list of key event names used by turtle-graphics?

While playing around with Python's Turtle module, I used some key events as the official documentation states: turtle.onkey(fun, key) Parameters: fun – a function with no arguments or None key – a string: key (e.g. “a”) or key-symbol (e.g.…
elegent
  • 3,857
  • 3
  • 23
  • 36
9
votes
3 answers

Python: Checking If Coordinates Are Within Circle

Possible Duplicate: How can I make Turtle recognize a circle? I have a function that draws a few circles and I am going to place dots inside them. Depending if the dot falls within the circle, depends on wether the colour will change or not. The…
MichaelH
  • 1,600
  • 3
  • 14
  • 20
8
votes
9 answers

Sierpinski triangle recursion using turtle graphics

I am trying to write a program that draws a sierpinski tree with python using turtle. Here is my idea: import turtle def draw_sierpinski(length,depth): window = turtle.Screen() t = turtle.Turtle() if depth==0: for i in…
AlexConfused
  • 801
  • 1
  • 10
  • 15
8
votes
1 answer

Save turtle output as jpeg

I have a fractal image creator. It creates a random fractal tree like thing. When done, it prompts the user to save the tree. I have it saving as a .svg right now and that works BUT I want it to save to a more convenient file type, like jpeg. Any…
Lillz
  • 283
  • 2
  • 5
  • 19
8
votes
2 answers

Function missing 2 required positional arguments: 'x' and 'y'

I am trying to write a Python turtle program that draws a Spirograph and I keep getting this error: Traceback (most recent call last): File "C:\Users\matt\Downloads\spirograph.py", line 36, in main() File…
user2803457
  • 83
  • 1
  • 1
  • 4
7
votes
2 answers

Why is turtle lightening pixels?

My program for creating a Mandelbrot set has a bug: whenever the pen changes colors, and every 42nd pixel after that, is lighter. This is, rather coincidentally, a mandelbug (yes, I just learned that term), as it is inconsistent for many pixels near…
IronBeard
  • 229
  • 2
  • 4
  • 12
7
votes
2 answers

Is there a way can set the background color for python turtle?

I am trying to set the background color of my turtle graphic, is there a way can set the background color for python turtle?
phhnk
  • 121
  • 2
  • 4
  • 10
7
votes
1 answer

How to draw fibonacci sequence using turtle module

This is my first question ever, and I am a complete and utter beginner, so please don't eat me :) What I am trying to to is to draw a fibonacci sequence using the Python turtle module. My code is as follows: import turtle zuf =…
Ejdzbikej
  • 71
  • 2
  • 6