Answers for "how to change pen color in python turtle"

2

how to change background color in python turtle

import turtle
wn=turtle.Screen()
wn.bgcolor("black")
wn.title("This is my screen title!")
Posted by: Guest on December-13-2020
4

python turtle movement

import turtle

wn = turtle.Screen()
wn.setup(width=700,height=400)
wn.title("Python Turtle Movement")

def playerUp():
  player.sety(player.ycor()+10)
def playerDown():
  player.sety(player.ycor()-10)
def playerRight():
  player.setx(player.xcor()+10)
def playerLeft():
  player.setx(player.xcor()-10)

player = turtle.Turtle()
player.speed(0) #this will make your player created instantly
player.shape("square") #set player shape
player.color("red") #set player color
player.penup() #prevent drawing lines
player.goto(0,0) #set player location

wn.onkeypress(playerUp, "w") #function, key
wn.onkeypress(playerDown, "s")
wn.onkeypress(playerRight, "d")
wn.onkeypress(playerLeft, "a")

#update the window
while True:
  wn.update()
Posted by: Guest on February-18-2020
0

python turtle pencolor rgb

t.pencolor(83, 58, 27)
Posted by: Guest on May-31-2021

Code answers related to "how to change pen color in python turtle"

Python Answers by Framework

Browse Popular Code Answers by Language