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

How to turn python turtle to specific rotation

I want python turtle to turn to specific rotation because after drawing something random, I can't know what is turtle's rotation. Is there a command that in I can type exact rotation that I want for turtle to turn? (lt and rt can't help)
0
votes
1 answer

Is it possible to make Python turtle goto a position within parameters

For a project I need to use the goto command alot and for something like trees I only want the turtle to goto to between certain coords for example I only want it to draw a tree within (300,0) and (500,100)
0
votes
1 answer

IndexError: tuple index out of range in Turtle module

IndexError: tuple index out of range in Turtle module here is my code import turtle t = turtle.Turtle() s = turtle.Screen() s.bgcolor("black"), t.speed(0) col = ("yellow", "red", "pink", "cyan", "light", "green", "blue") for i in range(150): …
Rasel
  • 121
  • 1
  • 4
  • 14
0
votes
1 answer

Running multiple loops whilst still listening to key inputs

I am working on a game driver but I can't get multiple loops to work together, I've tried using Threading and Multiprocessing but nothing seems to be working. import turtle from time import sleep from functools import partial game_active =…
0
votes
0 answers

Python turtle: Print input text at a specific coordinate in the window

For my first ever assignment, my instructor has requested that we receive string input from the user, output to a variable, and display that user input at a certain coordinate on the turtle window before actually drawing a five point start at…
Ants
  • 11
  • 2
0
votes
1 answer

how to solve keybinding python turtle?

i am new in python i am trying to make a ping pong game but i cant move my turtle objects with key bindings there is my code import turtle # inishialize screen the_ping_pong_windows = turtle.Screen() # set the screen…
0
votes
0 answers

How to get the position coordinates of a turtle that is being moved by a mouse using the ondrag() function

I am trying to create a sort of pingpong game in python using turtle.The player moves his paddle by dragging his finger on the screen but now I need a function that will be giving me the current position of the paddle in terms of x and y so that I…
Lord vic
  • 21
  • 2
0
votes
0 answers

How to give multiple turtles the same command in Python?

I'm trying to create a simple code that uses six turtles to create a triangle lattice that expands from the centre. Is there a way to give all the turtles the same command at once instead of writing it all out? Thanks.
0
votes
0 answers

How can I completely fill new drawn shapes over old shapes

I am trying to write a program in Java that draws trees filling the screen. I have variables set to randomly place a tree on the x-axis and move down 10 steps each time. The problem I am encountering is when the new trees are drawn they overlap the…
0
votes
1 answer

Can't import .gif file into python turtle library

Trying to import some shapes into a simple code but getting the error: _tkinter.TclError: couldn't open "tess.gif": no such file or directory edit: everything is in the same folder Kal = turtle.Turtle() Arrow = turtle.Turtle() Turtlebutton =…
0
votes
1 answer

Deformed Circle in Python Turtle Graphics Animation

Is there any way to not have the circle be deformed during the animation produced by the code below please? It seems that at anything other than a very slow speed the animation is unusabley distorted. import turtle SPEED = 5 # ms between…
Robin Andrews
  • 3,514
  • 11
  • 43
  • 111
0
votes
1 answer

How to prevent Turtle from crossing the line in Turtle Python?

I want make maze in Turtle, but I don't know, how to prohibit to Turtle crossing walls (lines). I tried #imports from turtle import * player_1 = Turtle() #walls (lines) class Walls: goto(-100, 0) goto(100, 0) #start position of player…
Vioar
  • 3
  • 5
0
votes
1 answer

Is there a way to run a boolean if statement in Python Turtle?

I'm editing a Turtle Pong template and realized that two paddles can't move at the same time, so I'm trying to fix that bug by having it so, when a key is pressed, a boolean is set to true, and that is referenced in an if statement to move up or…
0
votes
1 answer

How can I use the tkinter module to make a controller for turtle?

I want to make a controller for the turtle module using the tkinter module. I wrote a code myself but it didn't work. It also contains four forward, backward, left and right. Can someone answer me and explain with a solution? from tkinter import…
0
votes
1 answer

Need a solution so when I press Enter, turtle draws a different shape

The code I am trying to write needs to make 5 different shapes, which only one is included. I am not worried about coding the other 4. What I need to know is how do I set it up so every time I press enter, turtle will perform a different function…