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

How to get multiple keybindings to work simultaniously in turtle graphics?

I am making a game in python called pong. Can I get 2 different turtles in turtle graphics to respond simultaneously to keybindings? Here is the code: import turtle class paddle(turtle.Turtle): def __init__(self, x_cord, keybindings): …
game movie
  • 107
  • 1
  • 1
  • 8
3
votes
0 answers

In ROS turtlesim how to move turtle in sine curve

In ROS turtlesim, how can we move turtle in sine path? I know we need to use proportional controller to achieve this. But am not getting actual method to do so. I have attached the code for the same which i have tried till now Note: in callback…
3
votes
1 answer

How to make turtle draw quicker?

My code: import turtle screen = turtle.Screen() bob = turtle.Turtle() screen.bgcolor("black") bob.speed(0) def crazy(): for i in range(360): for colors in ['red', 'yellow', 'green', 'purple', 'orange', 'blue']: …
Kromydas
  • 111
  • 3
  • 11
3
votes
1 answer

this line of code makes the program unreactive to the restart function

I try to write a program in python that lets the user to put a bet on one of the turtles and after the race tells him if he was correct or not. I want to let the user choose if he wants to restart the race by clicking 'r' - ( i used the turtle.onkey…
Ron Gerbi
  • 31
  • 2
3
votes
2 answers

Why does turtle open an even smaller screen when the canvas is small?

I'm trying to draw on a small 200x200 screen using turtle, however the drawing doesn't pop up as full size, it opens a smaller window and I have to scroll up/down, left/right (just a bit) to see the whole drawing. I don't have this problem with…
user13009461
3
votes
1 answer

screensize of turtle in python

I am trying to work with the screen in turtle and am confused about the dimensions of the screen. So in this example: import turtle screen = turtle.Screen() print(screen.screensize()) turtle.done() Python prints the dimension of the turtle…
Another_coder
  • 728
  • 1
  • 9
  • 23
3
votes
2 answers

How do I change the color of the turtle, not the pen?

How do you change what color the turtle looks, not the pen? I want the turtle to draw white on the screen, but if I change the color to 'white' I can't see the turtle anymore. Is there something like turtle.turtlecolor or something?
3
votes
2 answers

Struggling with function parameter

So I have this assignment to make a turtle draw a polygon using a function: draw_poly(t, n, sz) Where t = turtle name, n = amount of angles and sz = size of each side. I have come up with the following solution: import turtle def draw_poly(t, n,…
LST-2020
  • 57
  • 3
3
votes
3 answers

Change object color upon contact with another object

I have been watching this video on youtube--https://www.youtube.com/watch?v=horBQxH0M5A which creates a list of balls bouncing around. I'm trying to alter the code to make one ball red, the rest green, and when the red ball "touches" a green ball,…
3
votes
1 answer

How do I hide something a turtle drew previously?

I used turtle.write to write something on the screen. How do I hide it completely. Not the turtle icon thing, but what's written.
penny12
  • 57
  • 4
3
votes
3 answers

How to draw some graph without using data and function? (turtle analog)

Is there any method to make a graph like following picture? In Gnuplot, have any command like "lineTo , moveTo , arc, ... etc"? If I want to produce some picture like this What I should do for producing this picture? in turtle graphics, just need…
LessonWang
  • 65
  • 5
3
votes
1 answer

Turtle: timer keeps blinking

I have some code for a timer: from turtle import Screen, Turtle, bgcolor # --- functions --- def delSec(string): if len(string) == 1: return "0" + string else: return string def tick(): global milisecs, ticking …
Mike Smith
  • 527
  • 2
  • 6
  • 20
3
votes
4 answers

How can I create a button in turtle?

How to create a simple button in turtle, python, where if you click it, you can define it to print messages, or do other, more complex things.
Mike Smith
  • 527
  • 2
  • 6
  • 20
3
votes
1 answer

Can't run turtle on jupyter notebook (turtle graphic window not responding)

First Question I was doing an example from ThinkPython 2e Chapter 4 Case Study: Interface Design, when I stumbled upon turtle module. I use jupyter notebook as an IDE to do exercise. Here's the code import turtle bob = turtle.Turtle() When I ran…
ordem
  • 130
  • 2
  • 9
3
votes
1 answer

Increase the number of steps Python turtle performs each second?

My class has been learning Python's Turtle module recently (which I gather uses tkinter), and I was wondering if there was a way to adjust the rate at which tkinter/turtle executes its code, because it doesn't seem (from my limited understanding) to…
Shadiester
  • 33
  • 5