【发布时间】:2017-06-27 08:23:05
【问题描述】:
当我使用 Idle for Python 3.6 运行下面的代码时,海龟屏幕出现在 Idle 屏幕下方,这非常不令人满意。
如果我省略背景颜色的输入请求而只使用wn.bgcolor("blue"),则窗口会按我的意愿显示在前面。
我查看了文档并找到了turtle.setup(width=_CFG["width"], height=_CFG["height"], startx=_CFG["leftright"], starty=_CFG["topbottom"]),但似乎没有任何类型的 z-index 参数。
有什么建议吗?
import turtle
bg_colour = input("Enter the desired background colour: ")
wn = turtle.Screen()
wn.bgcolor(bg_colour) # Set the window background color
wn.title("Hello, Tess!") # Set the window title
tess = turtle.Turtle()
tess.color("blue") # Tell tess to change her color
tess.pensize(3) # Tell tess to set her pen width
tess.forward(50)
tess.left(120)
tess.forward(50)
wn.mainloop()
【问题讨论】: