【发布时间】:2021-05-14 14:01:45
【问题描述】:
我使用screen.setup() 来设置屏幕,但是当用户调整屏幕大小时
如何获得更改,以便让应用程序响应调整大小
我需要将整数更改为screen_width-20:
screen = Screen()
screen.setup(height=600,width=800)
这是我实现的版本
#collision with wall
if ball.ycor() > 280 or ball.ycor() < -280:
ball.bounce_y()
我想要实现的是
#collision with wall
if ball.ycor() >screen_height-20 or ball.ycor() < -(screen_height-20):
ball.bounce_y()
【问题讨论】:
-
是否 screen.window_height() 返回屏幕的高度?见docs.python.org/3/library/turtle.html#using-screen-events
-
是的,它返回并使用它们有效。谢谢????
标签: python responsive-design turtle-graphics