【问题标题】:Determine the window size turtle python setup确定窗口大小乌龟python设置
【发布时间】:2018-09-12 12:51:42
【问题描述】:

在 Python 3+ 中,我尝试运行 turtle.setup(400, 500),但它不起作用。

没有名为 setup 的引用。

如何在 Python 3 中使用屏幕设置?

【问题讨论】:

    标签: python python-3.x turtle-graphics


    【解决方案1】:

    根据您导入海龟的方式,有(至少)三个选项。从最差到最好:

    选项 1:

    from turtle import *
    
    setup(400, 500)
    

    选项 2:

    import turtle
    
    turtle.setup(400, 500)
    

    选项 3:

    from turtle import Turtle, Screen
    
    screen = Screen()
    screen.setup(400, 500)
    

    如果这些对您不起作用,请使用有关您运行 Python/turtle 的环境的更多信息更新您的问题。

    【讨论】:

      猜你喜欢
      • 2016-07-01
      • 2019-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多