1

每当我输入 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 
4

0 回答 0