Python小程序之五星红旗
# -*- coding: UTF-8 -*- import turtle turtle.setup(700,500,0,0) turtle.color('yellow') turtle.bgcolor('red') turtle.fillcolor('yellow') def mygoto(x,y): turtle.up() turtle.goto(x,y) turtle.down() def draw(z): turtle.begin_fill() for i in range(5): turtle.forward(z) turtle.right(144) turtle.end_fill() mygoto(-300,130) draw(100) mygoto(-170,220) draw(50) mygoto(-130,160) draw(50) mygoto(-140,80) draw(50) mygoto(-170,10) draw(50) turtle.done()
运行结果截图: