第 3 步:要查看我们的set_stage()函数的效果,我们需要调用它。现在让我们在 main 函数中执行此操作!

  • 我们使用 main 函数来构造我们的代码,并确保很少有代码存在于函数之外。
  • 并将Function Call拖到主函数内,使其缩进四个空格。
  • my_function()更改为set_stage()

To navigate the page using the TAB key, first press ESC to exit the code editor.

def set_stage(): stage.set_background("soccerfield") stage.disable_floor() def main(): """ Sets up the program and calls other functions """ main()
  • Run Code
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)