国旗代码编程python
时间: 2023-11-07 13:04:26 浏览: 48
国旗代码编程python如下所示:
```python
import turtle
def drawStars():
x = -10
y = 0
for k in range(4):
x = -15
for i in range(6):
turtle.goto(x, y)
turtle.color('white')
turtle.begin_fill()
for j in range(5):
turtle.left(144)
turtle.forward(20)
x -= 50
turtle.end_fill()
y = 350 / 13 * 2
def drawRectangle():
turtle.penup()
turtle.goto(-200,200)
turtle.begin_fill()
turtle.fillcolor("red")
turtle.pendown()
turtle.forward(400)
turtle.right(90)
turtle.forward(280)
turtle.right(90)
turtle.forward(400)
turtle.right(90)
turtle.forward(280)
turtle.right(90)
turtle.end_fill()
drawRectangle()
drawStars()
turtle.done()
```