每当我在晚上输入n时,它只播放一天的周期。我通常是python的新手,非常感谢帮助。
userinput = input("Is it day (d) or night (n) - type d or n:")
n = win.setBackground("MidnightBlue")
d = win.setBackground("DeepSkyBlue")
n_message = ("Time has been set to night!")
d_message = ("Time has been set to day!")
for character in range(1333):
if userinput == n:
print(n_message)
win.setBackground("MidnightBlue")
update(30)
sun.undraw()
moon = Circle(Point(100, 100), 90)
moon.setFill("LightYellow")
moon.draw(win)
moon_cover = Circle(Point(140, 90), 60)
moon_cover.setFill("MidnightBlue")
moon_cover.setOutline("MidnightBlue")
moon_cover.draw(win)
else:
print(d_message)
update(30)
win.setBackground("DeepSkyBlue")
break