2

I wrote a Python 3.7 program with Turtle Graphics. It is a simple program and works fine, but I want it to run full-screen when I initiate the program. How can I do this? There is no full-screen option in the Turtle documentation.

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()
cdlane
  • 40,441
  • 5
  • 32
  • 81
Kirill
  • 303
  • 3
  • 18
  • Does this answer your question? [Turtle.Screen() Fullscreen on Program Startup](https://stackoverflow.com/questions/34687998/turtle-screen-fullscreen-on-program-startup) – ggorlen Feb 28 '23 at 19:02

1 Answers1

2

The width and height arguments to the setup() method take integer (pixel) and floating point (percentage of screen). By supplying 1.0 you'll get the largest window that turtle can make:

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

But this isn't necessarily the operating systems sense of Full Screen where the window overlays everything. It's just the largest window turtle can create given available screen real estate.

cdlane
  • 40,441
  • 5
  • 32
  • 81
  • Thank you so much ! This helps me a lot ! But, I don't know why, the window opens in its absolute value, but there seems to be a little space (about less than 10px) in the left edge that seems to not be filled with the Turtle window. It is not a big problem, but i want to know why this happens ! If you can, please respond me ! Thanks ! – Kirill May 11 '19 at 19:27