PlayTurtle
v2.0.0
Play Turtle为孩子们通过在屏幕上移动乌龟来学习编程的方法
它提供了Python Turtle模块中发现的一部分命令,以抽象复杂的编程思想。
有多种安装游戏乌龟的方法
与pip
$ pip install playturtle
# Provides the play-turtle command克隆回购并在本地运行
$ git clone https://github.com/mordy-python/PlayTurtle
$ cd PlayTurtle
$ python playturtle.py
# Can also install with `pip install .`
# Will provide the `play-turtle` command ForwardBackRightLeftSpeedWidthShapeSquareCircleColorHideShowBegin fillEnd fillBgcolorforwarddistanceforward命令将乌龟移动在屏幕上,在其后面画一条线。distance参数告诉乌龟移动多远。backdistanceback命令将乌龟向后移动,并在其前面绘制一条线。distance参数告诉乌龟移动多远。rightdegreesright命令向右转。degrees参数告诉乌龟旋转多少度。leftdegreesleft命令转动乌龟左。degrees参数告诉乌龟旋转多少度。speednew-speedspeed命令设置海龟绘图速度。new-speed参数告诉乌龟它应该移动的速度。widthnew-widthwidth命令设置海龟宽度(以像素为单位)。new-width参数指定了乌龟的新宽度。shapenew-shapeshape命令改变了乌龟的形状。new-shape参数指定应显示什么形状。注意:
new-shape参数只能出现以下内容:箭头,圆,乌龟,正方形,三角形,经典
squareside-lengthsquare命令在屏幕上绘制一个正方形side-length参数确定正方形的两侧的时间circleradiuscircle命令在屏幕上绘制一个圆圈radius参数确定圆的大小colornew-colorcolor命令更改乌龟的颜色及其绘制的线条new-color参数指定要更改的颜色在此处查看所有命名颜色的列表
hidehide命令隐藏了乌龟。它仍然会画,只是看不见showshow命令显示乌龟是隐藏的。如果已经可见,那什么也不做begin-fillbegin-fill命令将使用当前color启动填充过程。但是,在调用end-fill之前,什么都不会填充。end-fillend-fill命令将填充在begin-fill命令和自身之间绘制的任何形状。如果没有begin-fill命令, end-fill将什么都不做。bgcolornew-colorbgcolor命令更改画布的背景颜色new-color参数指定应将其更改为什么颜色在此处查看所有命名颜色的列表