简体   繁体   English

我不能用乌龟模块在 python 中制作桨

[英]I cant make a paddle in python with the turtle module

I cant find the problem, i have looked through the code several times.( i am a beginner)It doesnt make a paddle.我找不到问题,我已经看了好几遍代码。(我是初学者)它不会做桨。

import turtle 

wn = turtle.Screen()
wn.title("pong by ChunkyChungus")
wn.bgcolor("black")
wn.setup(width=800, height=600)
wn.tracer(0)

paddle_a = turtle.Turtle()
paddle_a.speed(0)
paddle_a.shape("square")
paddle_a.color("white")
paddle_a.shapesize(stretch_wid=5, stretch_len=1)
paddle_a.penup()
paddle_a.goto(-350, 0,)


wn.exitonclick()

Please help me with this?请在这件事上给予我帮助?

It looks like 'wn.tracer(0)' is what was blocking the turtle shape.看起来 'wn.tracer(0)' 是阻止海龟形状的原因。 The following code works for me.以下代码对我有用。 Notice that I've commented out 'wn.tracer(0)'.请注意,我已经注释掉了“wn.tracer(0)”。

import turtle 

wn = turtle.Screen()
wn.title("pong by ChunkyChungus")
wn.bgcolor("black")
wn.setup(width=800, height=600)
# wn.tracer(0)

paddle_a = turtle.Turtle()
paddle_a.speed(0)
paddle_a.shape("square")
paddle_a.color("white")
paddle_a.shapesize(stretch_wid=1, stretch_len=5)
paddle_a.penup()
paddle_a.goto(-350, 0,)

wn.exitonclick()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM