运行 海龟程序在启动时全屏显示
Run a turtle program in full screen when initiated
我用 Turtle Graphics 写了一个 Python 3.7 程序。这是一个简单的程序,运行良好,但我希望它在启动程序时 运行 全屏显示。我怎样才能做到这一点? Turtle 文档中没有全屏选项。
import turtle
from turtle import *
a = turtle.Turtle()
a.speed(10)
a.color('red', 'blue')
# a.begin_fill()
for i in range(90):
a.fd(200)
a.lt(169)
# a.end_fill()
turtle.done()
setup()
方法的 width
和 height
参数采用整数(像素)和浮点数(屏幕百分比)。通过提供 1.0
你会得到最大的 window 乌龟可以制造:
from turtle import Screen, Turtle
screen = Screen()
screen.setup(width=1.0, height=1.0)
a = Turtle()
a.speed('fastest')
a.color('red', 'blue')
# a.begin_fill()
for _ in range(36):
a.forward(200)
a.left(170)
# a.end_fill()
screen.mainloop()
但这不一定是 全屏 的操作系统意义,其中 window 覆盖 一切 。它只是最大的 window 海龟可以创建给定的可用屏幕空间。
我用 Turtle Graphics 写了一个 Python 3.7 程序。这是一个简单的程序,运行良好,但我希望它在启动程序时 运行 全屏显示。我怎样才能做到这一点? Turtle 文档中没有全屏选项。
import turtle
from turtle import *
a = turtle.Turtle()
a.speed(10)
a.color('red', 'blue')
# a.begin_fill()
for i in range(90):
a.fd(200)
a.lt(169)
# a.end_fill()
turtle.done()
setup()
方法的 width
和 height
参数采用整数(像素)和浮点数(屏幕百分比)。通过提供 1.0
你会得到最大的 window 乌龟可以制造:
from turtle import Screen, Turtle
screen = Screen()
screen.setup(width=1.0, height=1.0)
a = Turtle()
a.speed('fastest')
a.color('red', 'blue')
# a.begin_fill()
for _ in range(36):
a.forward(200)
a.left(170)
# a.end_fill()
screen.mainloop()
但这不一定是 全屏 的操作系统意义,其中 window 覆盖 一切 。它只是最大的 window 海龟可以创建给定的可用屏幕空间。