python俩种方法画日本国旗
python俩种⽅法画⽇本国旗
刚刚学习python画图,我就画⼀下最简单的国旗吧1,第⼀种⽅法是⽤pygame来画,第⼆种⽅法⽤turtle来画。
2,第⼀种⽅法pygame来画
#coding:utf-8
import pygame, sys
pygame.init()
东莞理工学院是几本
screen = pygame.display.set_mode([640,480])
screen.fill([255,255,255])
pygame.draw.circle(screen,[255,0,0],[320,240],100,0)
pygame.display.flip()
running = True
梦见别人拿刀杀我while running:
for event in ():
pe == pygame.QUIT:
running = False
pygame.quit()
2.1查看结果
3,使⽤turtle来画
#encoding:utf-8
#python3.6
单招和高考的区别是什么
import turtle
#⽇本国旗为“太阳旗”,呈长⽅形bai,长与宽之⽐为3∶2。旗⾯为⽩⾊,du正中有⼀轮红⽇。#红⽇半径
print("150")
r=150
#画布尺⼨(宽,⾼)
turtle.screensize(900.600)
#设置显⽰窗⼝像素
turtle.setup(width=900,height=600)
#移动画笔起点
turtle.penup()
<(0,-r)
turtle.pendown()
#设置画笔属性如何做疙瘩汤
turtle.pensize(5)
turtle.pencolor("red")
turtle.fillcolor("red")
#绘制速度,1~10个不同速度等级,⼩于1或者⼤于10⽴即绘制
抖音晒娃十字短句
turtle.speed(0)
#开始绘制红⽇实用格斗技巧
turtle.begin_fill()
turtle.circle(r)
turtle.mainloop()
3.1查看效果
4,以上是俩种画⽇本国旗的⽅法。

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。