python安卓版turtle模块下载_Python的Turtle模块

我的朋友做了一个:import turtle

import random

t=turtle.Pen()

def forward():

t.forward(50)

def left():

t.left(90)

def right():

t.right(90)

def red():

t.color('red')

def green():

t.color('green')

def blue():

t.color('blue')

def yellow():

t.color('yellow')

def black():

t.color('black')

def special_color():

t.color(random.random(),random.random(),random.random())

def up():

t.up()

def down():

t.down()

def circle():

t.circle(30)

#def writepi():

# t.write('π', font('Times New Roman',30,'bold'))

def circleshape():

t.shape('circle')

#def square():

# t.shape('square')

def triangle():

t.shape('triangle')

def arrow():

t.shape('arrow')

def classic():

t.shape('classic')

def turtle():

t.shape('turtle')

def layegg():

t.down()

t.begin_fill()

t.circle(4)

t.end_fill()

t.up()

def reset():

t.home()

t.clear()

from tkinter import*

tk=Tk()

forward=Button(tk,text='forward', command=forward)

forward.pack()

left=Button(tk,text='left', command=left)

left.pack()

right=Button(tk,text='right', command=right)

right.pack()

red=Button(tk,text='red', command=red)

red.pack()

green=Button(tk,text='green', command=green)

green.pack()

blue=Button(tk, text='blue', command=blue)

blue.pack()

yellow=Button(tk, text='yellow', command=yellow)

yellow.pack()

black=Button(tk, text='black', command=black)

black.pack()

specialcolor=Button(tk, text='random color', command=special_color)

specialcolor.pack()

up=Button(tk, text='up', command=up)

up.pack()

down=Button(tk, text='down', command=down)

down.pack()

circle=Button(tk, text='circle', command=circle)

circle.pack()

#pi=Button(tk, text='π', command=writepi)

#pi.pack()

cs=Button(tk, text='make it a circle', command=circleshape)

cs.pack()

#square=Button(tk, text='make it a square', command=square)

#square.pack()

triangle=Button(tk, text='make it a triangle', command=triangle)

triangle.pack()

arrow=Button(tk, text='make it an arrow', command=arrow)

arrow.pack()

clasic=Button(tk, text='back to normal', command=classic)

clasic.pack()

turtle=Button(tk, text='make it a turtle', command=turtle)

turtle.pack()

egglay=Button(tk, text='lay an egg', command=layegg)

egglay.pack()

resset=Button(tk, text'reset it all', command=reset)

resset.pack()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值