启动时以全屏方式运行海龟程序

2024-03-28

我用 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()

The width and height的论据setup()方法采用整数(像素)和浮点(屏幕百分比)。通过提供1.0你会得到海龟可以制作的最大的窗口:

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()

但这不一定是操作系统的意义全屏窗口覆盖的位置一切。这只是给定的可用屏幕空间所能创建的最大的窗口乌龟。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

启动时以全屏方式运行海龟程序 的相关文章

随机推荐