python terminator_使用exitonclick()后,Python Turtle.Terminator (Python Turtle.Terminator even after usi...

Let the method screen.exitonclick() be the last statement in your code without indenting it.

You use this method when your using a Python IDE such as Pycharm, Spyder etc.

I don't know if you have heard of the method screen.mainloop()

This method enables you see the output of your code when you run it in a Python IDE.

Without this method, your output would appear in a flash.

I rewrote your code and here's mine

from turtle import Turtle

t=Turtle()

def square():

t.up()

t.setpos(-50,-50)

t.down()

for i in range(4):

t.forward(100)

t.right(90)

def triangle():

t.up()

t.setpos(50,50)

t.down()

for i in range(3):

t.forward(100)

t.right(120)

def star():

t.up()

t.setpos(-200,100)

t.down()

for i in range(5):

t.forward(150)

t.right(144)

square()

triangle()

star()

t.screen.exitonclick()

You can also check this excellent guide in Python turtle

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值