Questions tagged [python-turtle]

The python turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways.

507 questions
-2
votes
2 answers

Cursor moving off line Turtle

I am currently completing a programming task in Python using the Turtle module, I have the following code: from turtle import * number_of_shapes = 4 for shape in range(1, number_of_shapes + 1): size = shape * 20 for sides in range(4): …
user11416172
-2
votes
1 answer

How Do Can You Make A Turtle Detect If It Is Touching A Specific Colour On Python

I need my turtle to do different things depending on which colour it is touching. Background: [1]: https://i.stack.imgur.com/DcpUR.gif I am used to scratch and know this is possible on that but wish to know if there is any way to do this on python.
-2
votes
1 answer

Why isn't star colored completely?

from turtle import * o=Turtle() d=Screen() o.begin_fill() o.width("2") o.color("yellow") extent1=150**2*3.14 print(extent1) o.circle(radius=150,extent=extent1,steps=10) o.end_fill()
-2
votes
1 answer

Visualize the merge sort

I have to create a code that let visualize how the merge sort works, using turtle module. Here is my code import turtle from random import randint import time def draw_bar(x,y,w,h): turtle.up() turtle.goto(x,y) turtle.seth(0) …
Poss
  • 81
  • 1
  • 2
  • 10
-2
votes
1 answer

How can I draw this figure in Python using turtle? Sorry, new to this

enter image description here Hi, I'm trying to draw this shape using Python turtle for a learning group and I'm completely lost. Please help.
-2
votes
1 answer

Why is my code only printing x and y once?

I am trying to be able to move the turtle to my mouse click than print x and y. import turtle tim = turtle.Turtle() tim.shape('turtle') screen = tim.getscreen() def getPos(): # this should move turtle to mouse click and print coords …
Ncampy
  • 1
-2
votes
1 answer

How do I make a linear gradient with Python Turtle?

I'm currently trying to replicate this image: https://imgur.com/a/IZIPGkg I'm trying to make that gradient in the background but I have zero clue how to do it and there's basically nothing on the internet. Edit: I have the RGB colors for both ends…
-2
votes
2 answers

Int object is not callable when calling an object within a class

I am making a program that has 2 spaceships battle. It is working so far but when we call the attack function we get this error: "TypeError: 'int' object is not callable on line 54" I spent a while debugging but I can't figure out where it went…
-2
votes
1 answer

User input Turtle and/or Pygame

Is there anyway to get a user input within the user interface in Python (pygame OR turtle). I'm relatively new to Python and was wondering how to get this input through the INTERFACE rather than the terminal.
-2
votes
3 answers

Is there a way in python (using turtle) to draw an cylinder?(Reading height, radius and volume from array)

I was wondering if there was any way to draw a cylinder/tunnel with python turtle(with data (radius, volume and height) from an array)? The list of modules I am allowed to use are as following : -astropy v1.3.2 -Beautiful Soup v4.6.0 -cryptopgraphy…
-2
votes
1 answer

Colour codes in python are not formatting correctly

In Python 3.8.3 whenever I try to implement colored text in python like \033[1;93m it keeps on saying [32m. Can I have some help, because it doesn't usually happen? I've been searching the internet for hours in end, leading to no avail. Any help…
-2
votes
3 answers

Merge the code from 2 for-loops into 1 for-loop

I want to make my script as short as possible: from turtle import * for _ in range(10): lt(72) fd(71) rt(108) fd(71) for _ in range(10): for s in [(29,90),(73,72),(73,90),(29,72)]: fd(s[0]) rt(s[1]) As you can…
Ann Zen
  • 17,892
  • 6
  • 20
  • 39
-2
votes
1 answer

How to make spiral spin in turtle?

I am trying to make a game, and I made a main character. Here is the code for the main character: from turtle import * from random import * chandra = Turtle(shape="turtle") chandra.speed("fastest") COLORS = ["orange", "blue", "red", "green",…
10 Rep
  • 2,325
  • 7
  • 15
  • 28
-2
votes
1 answer

A main menu in turtle

Can someone please explain to me why the program gives the "Else" response no matter where you click and why it repeats itself till it crashes? I dont have a for loop or while loop there so i dont understand. Could it be the onscreenclick() or…
-2
votes
2 answers

Tie circle radius to window size in Python Turtle

In Python turtle, when drawing objects on the screen, if there was a way to have a circle's radius connected to the window width or height, so that it can be resized by altering the window size?
1 2 3
33
34