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
4
votes
1 answer

How to draw a tiled triangle with python turtle

I am trying to draw a tiled equilateral triangle that looks like this using python's turtle. I would like to be able to have either 16,25,36,49 or 64 triangles. My initial attempts are clumsy because I havent figured out how to neatly move the…
user2175783
  • 1,291
  • 1
  • 12
  • 28
4
votes
2 answers

Python Turtle Graphics - Bring A Turtle To The Front

I have two turtles in my program. An animation happened where they collide together, but I would like one turtle to be on top of the other like this: So, my question is - how can I make this happen - is there a simple line of code such as:…
A Display Name
  • 367
  • 1
  • 9
  • 18
4
votes
2 answers

Python Turtle - Turtle Location

I want to make the turtle goto the floor if it is above a set of coordinates: something like this: floor = -323 if turtle above floor: turtle.goto(floor) But I don't know how the 'if' statement would work, as you can't simply put 'if turtle…
A Display Name
  • 367
  • 1
  • 9
  • 18
4
votes
2 answers

How to find the radius of a circle drawn using Turtle Python Graphics?

This is my code: import turtle bob = turtle.Turtle() # Creating the object "bob" def draw_circle(t): for i in range (360): # Loop for drawing a circle t.fd(1) # Draw a line with the length of 1 pixel in the forward direction …
slightly_toasted
  • 335
  • 5
  • 18
4
votes
2 answers

Change appearance of turtle

I am programming in python 3.2.2 turtle. I am able to make the turtle follow my cursor when I clack but now I have trouble changing the appearance of the turtle. In my code you will see a tank, and I want the image of the tank to be my turtle. Here…
bertrand
  • 111
  • 2
  • 10
4
votes
2 answers

turtle - How to get mouse cursor position in window?

How would I go about finding the current position of the mouse pointer in the turtle screen? I want it so I have the mouse position before I click and while im moving the cursor. I have searched google and this website can't find anything besides…
4
votes
6 answers

Turtle.Screen() Fullscreen on Program Startup

I am trying to write some code that will start a Screen fullscreen (fill the whole screen without having to click the maximize button) def __init__(self, states = 2): self.window = turtle.Screen() #self.window.screensize(1920,1080) …
Abhishek Patel
  • 587
  • 2
  • 8
  • 25
4
votes
2 answers

can a python turtle sample background colour?

I would like to use python's turtles to effectively simulate a lego robot. The lego robots have the ability to sample the colour that the robot is positioned over. With this in mind, I would like to create a background maze and have the robot find…
dougc905
  • 83
  • 5
4
votes
1 answer

Cant Add Shape (image)

I am trying to add a image to my code but it keep raising the error Bad arguments for register_shape I am following the tutorial at http://blog.trinket.io/using-images-in-turtle-programs/ my code is: import turtle screen = turtle.Screen() #…
Liron Lavi
  • 421
  • 1
  • 5
  • 16
4
votes
3 answers

Little assistance with my tic-tac-toe program

I need some help with my tic-tac-toe game that I created in Python 3. Have a look at my fun program and try it out. After that, please help me creating a while statement in my program. That is while the user choice of square if filled, you should…
socrates
  • 161
  • 1
  • 2
  • 10
4
votes
2 answers

Python turtle random walk within a boundary

I want to create a program using the turtle that makes 50 moves in a random direction for a random distance, staying within -300 to 300 on the x and y axis (by turning in the opposite direction and moving forward when it reaches the boundary). The…
MissWizify
  • 167
  • 1
  • 3
  • 12
4
votes
3 answers

Python draw n-pointed star with turtle graphics

My professor has asked our class to write a Python function that does as following: Draw a regular n-pointed star with side d - in a function named star(turtle, n, d) Here's the code that I have so far: def star(turtle, n, d): angle =…
BryanLavinParmenter
  • 416
  • 1
  • 8
  • 20
4
votes
11 answers

Turtle graphics, draw a star?

I want to draw a filled-in star, such as: I have this code so far: def draw_star(size,color): count = 0 angle = 144 while count <= 5: turtle.forward(size) turtle.right(angle) count += 1 …
ASm
  • 379
  • 4
  • 10
  • 20
4
votes
5 answers

How to make items draw at the same time in python using turtle?

I have a homework assignment, and I have to make four different turtles move like they are planets around the sun. I have it all written, its just a matter of making the turtles draw at the same time. I was wondering if there was a relatively easy…
Tom Plutz
  • 77
  • 1
  • 6
4
votes
1 answer

Python simple turtle progam

I am having trouble trying to finish a python turtle program. When I attempt to input x and y coordinates as well as a radius value for the function like t.drawSnowman(x = 25,y = 25,radius = 25) the program misbehaves when I input values.but if I…
John Anthony
  • 77
  • 2
  • 8