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
6
votes
2 answers

how to rotate text in python's turtle graphics

I want to make diagrams with python's turtle (teaching purposes). The label "values" for the y-axis should be rotated. Python's turtle has a method to write a string at current position: from turtle import * left(90) # does not help write("values",…
drumherum
  • 153
  • 3
  • 6
6
votes
3 answers

How to move turtles in Python 3 with arrow keys

I am having trouble getting my turtle to be able to follow the arrow keys, any help on how to do so would be greatly appreciated. I'm sure this question has been asked before, though I can't seem to find it, and the ones I do find are for older…
Elyad K
  • 77
  • 1
  • 2
  • 4
6
votes
2 answers

Is there a way to save turtle's drawing as an animated GIF?

I like what the turtle module does in Python and I'd like to output the entire animation of it drawing the shape. Is there a way to do this? GIF/MP4/anything that shows the animation. Note, I know that an external screen recorder will do the job,…
whatwhatwhat
  • 1,991
  • 4
  • 31
  • 50
6
votes
5 answers

Is it possible to change turtle's pen stroke?

I need to draw a bar graph using Python's turtle graphics and I figured it would be easier to simply make the pen a thick square so I could draw the bars like that and not have to worry about making dozens of rectangles and filling them in. When I…
Matt
  • 2,953
  • 3
  • 27
  • 46
6
votes
6 answers

Drawing with turtle(python) using PyCharm

I'm running the latest PyCharm Pro version and trying to run the below code from a scratch file but it doesn't seem to work import turtle wn = turtle.Screen() alex = turtle.Turtle() alex.forward(150) alex.left(90) alex.forward(75) By not…
DanyC
  • 99
  • 1
  • 1
  • 10
6
votes
2 answers

Setting the angle of a turtle in Python

I'm creating a function that will cause a giraffe to move in a certain direction and distance (don't ask). If the user types "west" in the parameters, the turtle should move west however the direction is. But the turtle's angle changes every time,…
Jonathan Spirit
  • 569
  • 3
  • 7
  • 14
6
votes
2 answers

Python Turtle pen colour

When I call t.pencolor('83, 58, 27') (turtle is imported as t) I get the TurtleGraphicsError: bad color string: 83, 58, 27 even though I have (I think) changed my colour mode. t.colormode(255) t.pencolor('83, 58, 27') I run python 2.7 on OS…
Brennan Wilkes
  • 213
  • 3
  • 4
  • 13
6
votes
7 answers

Spirograph Turtle Python

How can I play with a turtle and how can I use a turtle? I have trouble getting the thing to work as in the picture shown below (ignore the colors). from turtle import * from math import * def formulaX(R, r, p, t): x = (R-r)*cos(t) - (r +…
Singh2013
  • 169
  • 1
  • 4
  • 12
6
votes
1 answer

Difficulty using Itertools cycle

At the moment I have defined many shapes in Turtle using begin_poly and end_poly then register_shape. I want to be able to put all of these values into a list and, with a press of a button, cycle through the list hence changing the Turtle shape. I…
Hayden
  • 229
  • 2
  • 5
  • 12
6
votes
2 answers

how to rotate turtle shape in python

I registered the shape of my turtle in my roulette game to a roulette wheel. I want the wheel to spin 3 times. This is my program: register_shape("wheel.gif") wheel = None wheel =…
Greg Peckory
  • 7,700
  • 21
  • 67
  • 114
5
votes
1 answer

Why does python turtle graphics keep crashing/stop responding?

Whenever I try and run my program, it draws the two turtles and then the window stops responding. What I was expecting is that, until one of the pieces touches the other one based on me dragging it close to the other one, I will be able to drag both…
5
votes
4 answers

Python Turtle Graphics window shows nothing

I think my code is nothing wrong. Because it's very simple, it worked very well on my Windows PC, and shows no error message at all. from turtle import Turtle, Screen turtle = Turtle() screen = Screen() screen.exitonclick() However, on Pycharm on…
Brian
  • 51
  • 1
  • 3
5
votes
2 answers

Python - Turtle recreating image too slow

I got curious and wondered if I could have the pyautogui module detect the color from every few pixels from an image and have turtle recreate them in it's canvas using small circles. I ended up finding a way to make it work, and I liked how the…
5
votes
1 answer

Python Turtle object not moving

I am making a simple Object-oriented projectile simulation program in python. I am just using the Turtle and Math modules. The problem is when I try to simply move my projectile (as a test before integrating some equations) it does not move. import…
Mush-A
  • 435
  • 3
  • 11
5
votes
6 answers

How do I draw this shape in Turtle?

I got a challenge in a learning group today to draw this shape in python turtle library. I cannot figure out a way to express the geometrical solution to find the angles to turn and the size of the line I need. Can you please tell me how to draw…
Tes
  • 67
  • 3