Update flag.py

pull/526/head
Lazyaqu 2020-04-03 19:56:49 +08:00 committed by GitHub
parent dbe54797b0
commit 56eac4137d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -1,7 +1,9 @@
"""
用Python的turtle模块绘制国旗
"""
import turtle
from turtle import Turtle,Screen
turtle = Turtle()
screen = Screen()
def draw_rectangle(x, y, width, height):
@ -10,7 +12,7 @@ def draw_rectangle(x, y, width, height):
turtle.pencolor('red')
turtle.fillcolor('red')
turtle.begin_fill()
for i in range(2):
for _ in range(2):
turtle.forward(width)
turtle.left(90)
turtle.forward(height)
@ -67,8 +69,8 @@ def main():
# 隐藏海龟
turtle.ht()
# 显示绘图窗口
turtle.mainloop()
screen.mainloop()
if __name__ == '__main__':
main()
main()