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

name 'turtle' is not defined on line 4 in main.py

Sorry for dumb question, new to python. I have the following code, running python 3.7: from turtle import * color('blue', 'red') turtle.pu() turtle.goto(0,0) turtle.pd() begin_fill() forward(55) left(90) forward(110) When I click run, it says I…
Noah Brown
  • 123
  • 1
  • 3
  • 8
3
votes
2 answers

Python making turtle graphic by using list colors

I'm trying to make squares with change color each time when I click. but when I run this, it only fills out red color. How can I change color each times? import turtle t= turtle.Turtle() s=turtle.Screen() colors =…
장재현
  • 31
  • 1
  • 5
3
votes
2 answers

Python Turtle window crashes every 2nd time running

The code below is a basic square drawing using Turtle in python. Running the code the first time works. But running the code again activates a Turtle window that is non-responsive and subsequently crashes every time. The error message includes raise…
Daniel Moisio
  • 59
  • 1
  • 11
3
votes
2 answers

Point a Python Turtle towards certain coordinates

Is there any way to point the Turtle towards certain coordinates Any help with this with be appreciated.
Oscar Peace
  • 99
  • 1
  • 2
  • 11
3
votes
3 answers

Python turtle shapes

I am drawing something with python turtle , i used the shape functions but the shapes overdraw the others before them (i can see the shapes moving) , and i get just the last…
Isu
  • 330
  • 1
  • 4
  • 16
3
votes
2 answers

Python Turtle - Disable Window Resize

Is there a way to disable the window resizing in the Turtle module? E.G - Disable the maximize and minimize button and disable the ability to drag the window out or in. Thanks!
xVoidZx
  • 31
  • 1
  • 4
3
votes
2 answers

Clear only a part of the screen in turtle graphics

I'm using turtle graphics and I would like to clear only a part of the screen and keep the rest of the image/drawings intact. So far I've been drawing a white rectangle to clear a part of the image, but this is very slow and if the background isn't…
user9279287
3
votes
3 answers

Python Turtle: rotate custom cursor image

We are attempting a tank game in my class. I'm able to load the tank image however the image doesnt rotate. I did a search but cannot find a solution (or a simple one if it exists). Here's what I have so far (very elementary). I'm hoping there's a…
chappie
  • 119
  • 4
  • 12
3
votes
7 answers

Turtle direction in turtle graphics?

How can I tell a turtle to face a direction in turtle graphics? I would like the turtle to turn and face a direction no matter its original position, how can I achieve this?
Gabe Sweet
  • 65
  • 1
  • 1
  • 2
3
votes
1 answer

how to upside down a text in python turtle.write() method?

nowadays I'm writing a program to fetch 4 poker cards from 52 poker cards randomly and I have to draw these pokers by python turtle module. Now here's my question: cause there's an upside-down number in pokers, just like this(the bottom right corner…
Fletcher Wang
  • 45
  • 1
  • 4
3
votes
1 answer

How to draw a circle and a hexagon with the turtle module?

I want to use the turtle module and I want to do : Draw a red circle, then a yellow circle underneath it and a green circle underneath that. to draw a regular hexagon. can anyone tell me how to work on it?
sam
  • 47
  • 1
  • 1
  • 2
3
votes
2 answers

Python turtle.pensize() not changing the size of the pen

I am trying to change the pen size in Python 2.7. I know the pensize() command can be interchanged with width() (neither work), however the size of the pen stays the same no matter what value I enter. We use WingIDE to program in Python, though…
njbeep
  • 31
  • 1
  • 1
  • 3
3
votes
1 answer

How to make the turtle follow the mouse in Python 3.6

I'm assigned to create a similar version of slither.io in python. I planned on using Turtle. How do I make the turtle follow my mouse without having to click every time? This is how I would do it when clicking, but I would rather not have to…
Diamondspeed
  • 31
  • 1
  • 1
  • 3
3
votes
2 answers

How to set screen boundaries python turtle

How do I set screen boundaries so when the turtle reaches the edge it will stop or turn around import turtle t=turtle.Turtle() s=turtle.Screen() p=t.xcor() p1=t.ycor() x=300 y=300 s.setup(x,y) t.color("white") s.bgcolor("black") def up(): …
geek2001
  • 67
  • 1
  • 3
  • 7
3
votes
1 answer

Filling a shape with color in python turtle

I'm trying to fill a shape with a color but when I run it, it does not show. Am I not supposed to use classes for this? I am not proficient with python-3 and still learning how to use classes import turtle t=turtle.Turtle() t.speed(0) class…
geek2001
  • 67
  • 1
  • 3
  • 7