color()返回以一对颜色描述字符串或元组表示的当前画笔颜色和填充颜色,两者可分别由 pencolor() 和 fillcolor() 返回。color(colorstring), color((r,g,b)), color(r,g,b)输入格式与 pencolor() 相同,同时设置填充颜色和画笔颜色为指定的值。color(colorstring1, colors
trtl.pencolor('red') #making colour of the pen red trtl.pensize(5) #choosing the size of pen nib trtl.speed(1) #choosing the speed of drawing trtl.shape('turtle') #choosing the shape of pen nib trtl.forward(100) #top line trtl.right(90) trtl.forward(100) # right vertical...
end_fill() 浏览完整代码 来源:paint.py 项目:roni16-meet/MEET-YL1 示例2 def drawP(size): turtle.setheading(90) turtle.penup() turtle.forward(size*1.5); turtle.pendown() turtle.forward(size*0.5); drawSemi(size, direction="right", degrees=336, colour="black") 浏览完整代码 来源:Peter - ...
forward(100) turtle.right(90) count = count + 1 angie = turtle.Turtle() angie.shape("arrow") angie.color("blue") angie.circle(100) todd = turtle.Turtle() todd.shape("arrow") todd.color("green") todd_count = 0 whilte todd_count < 3: todd.forward(300) todd.left(120) todd_...
my_turtle.color("gold") my_turtle.begin_fill() my_turtle.pendown() for _ in range(36): my_turtle.forward(40) my_turtle.left(170) my_turtle.end_fill() # some colourful balls def ball(trt, x, y, size=10, colour="red"): trt.penup() trt.setpos(x, y) trt.color(colour) trt...
turtle.bgpic函数只接受gif格式的图片 创建画布中所有圆形对象 def make_circle(turtle_name, x, y, size, colour): turtle_name.color(colour) turtle_name.penup() turtle_name.setposition(x, y) turtle_name.dot(size) 1. 2. 3. 4. 5.
ws=turtle.Screen() ws.title("Python guides") turtle.speed(1) turtle.shape("turtle") turtle.forward(120) ws.exitonclick() Output: After running the above code we will get the following output we see a turtle is moving forward and the speed of the turtle is slowest. ...
import turtle turtle.shape("turtle") turtle.color("blue","yellow") turtle.pensize(6) for i in range(0,720): turtle.left(0.5) turtle.forward(1) turtle.exitonclick() 063.Draw three squares in a row with a gap between each. Fill them using three different colours. ...
(self):# 随机颜色self.colour = (randint(0,255), randint(0,255), randint(0,255))self.colours = ((randint(0,255), randint(0,255), randint(0,255)),(randint(0,255), randint(0,255), randint(0,255)),(randint(0,255), randint(0,255), randint(0,255)))self.firework = Particle(...
# importing turtle module import turtle def langton(): # Initializing the Window window = turtle.Screen() window.bgcolor('white') window.screensize(1000,1000) # Contains the coordinate and colour maps = {} # Initializing the Ant ant = turtle.Turtle() # shape of the ant ant.shape('square...