猫史档案馆


【初级PYTHON小课堂】特别篇:Hello turtle! 下篇

用户:LNI橘猫小猫LNI橘猫小猫查看:14 回复:6 评论:14 创建时间:2020-05-21T16:53:45


【初级PYTHON小课堂】

源自 橘猫小猫

 

 

——Hello turtle!——

哈罗!各位。今天我们继续来讲turtle。

还是给各位看一看一些代码,我懒得每个精细的讲:

t.seth(写数字)#面向的角度
t.speed(写数字)#速度
t.track(速度, 卡顿数)#动画调整
t.circle
1.t.circle(半径)#画一个360°的圆,
2.t.circle(半径, 角度)#画一个圆(角度有不同)

好哩,这些就是一部分代码。如果有补充还是可以发在评论区哟!

自己来试一试吧!

好哩,我来试着做一个作品。你们可以自己试一试哟!(用网页版也可以的)

import time
import turtle
import turtle as t
import random


shapes = ['circle', '喵', 'triangle']

print('LOADING...')
time.sleep(3)

print('Done!')
time.sleep(1)

print('01 circle')
time.sleep(0.25)
print('02 喵')
time.sleep(0.25)
print('03 tirange')
time.sleep(0.25)
print('04 shape list')
time.sleep(0.25)
shape_number = int(input('Input the shape number:'))

print('LOADING...')
time.sleep(1.25)

t.home()
if (shape_number == 1):
    for i in range(4):
        t.forward(150)
        t.right(90)
elif (shape_number == 2):
    t.circle(70)
elif (shape_number == 3):
    for j in range(3):
        t.forward(150)
        t.right(120)
elif (shape_number == 4):
    print(shapes)
else:
    pass
turtle.done()

if (shape_number < 4 and shape_number > 0):
    print('The shape is done!')
elif (shape_number == 4):
    print('These are shapes.')
else:
    print('wrong')

应该这节课就这么点。

你们可以去自由发挥!

 

 

谢谢支持

emotion_星能猫_欢迎

 

 

                                                                                                                      

自由创作

主题:绘图器

看看谁画得最好!

 


回复

上一页1 页 / 共 1下一页
LNI橘猫小猫LNI橘猫小猫

自由创作:

可发在论坛下方,期待哟!

格式:Python代码

点赞0


评论


一块软糖一块软糖

加油

点赞0


评论


一块软糖一块软糖

咱俩和作吧(我也会python)

点赞0


评论


蒟蒻OIer1048576蒟蒻OIer1048576

from turtle import *
shape = int(input("几边形?"))
def f(k):
    for i in range(shape):
        fd(k)
        left(360/shape)
for i in range(0,100,5):
    print("loading..., {}%".format(i))
    f(i)
done()

点赞2


评论


蒟蒻OIer1048576蒟蒻OIer1048576

#升级版
from turtle import *
shape = int(input("几边形?"))
color = ["#dd0000","#dd9900","#552200","#00dd00","#6666ff","#00dddd","#cc00cc","#ff00ff"]
speed(10)
def f(k):
    for i in range(shape-1):
        fd(k)
        left(360/shape)
for i in range(0,100,5):
    pencolor(color[i//5%len(color)])
    print("loading..., {}%".format(i))
    f(i)
done()

点赞2


评论


SKQASKQA

center_image

这个报错是啥意思

点赞0


评论