4

I am trying to write some code that will start a Screen fullscreen (fill the whole screen without having to click the maximize button)

def __init__(self, states = 2):
    self.window = turtle.Screen()
    #self.window.screensize(1920,1080)
    self.window.title('States')
    self.turtles = []

self.window.screensize maxes the resolution 1920x1080, but only inside the small screen. To reach the full screen width and height, you have to maximize it. Any way of fixing this problem?

Abhishek Patel
  • 587
  • 2
  • 8
  • 25

6 Answers6

7

I had the same problem, that also works:

import turtle
screen = turtle.Screen()

  #set size:

screen.setup(width = 1.0, height = 1.0)

  #remove close,minimaze,maximaze buttons:
canvas = screen.getcanvas()
root = canvas.winfo_toplevel()
root.overrideredirect(1)
3

Well after many days of searching, i finally found a solution

self.window = turtle.Screen()
self.window.screensize(sizex, sizey)
self.window.setup(width=1.0, height=1.0, startx=None, starty=None)
Abhishek Patel
  • 587
  • 2
  • 8
  • 25
2

The answer code didn't work for me in python3.5. I changed it to the following and it worked correctly.

wn.screensize()
wn.setup(width = 1.0, height = 1.0)
poncanach
  • 25
  • 1
  • 8
  • [`wn.screensize()`](https://docs.python.org/3/library/turtle.html#turtle.screensize) doesn't do anything here. The docs say "If no arguments are given, return current (canvaswidth, canvasheight)" but you don't do anything with this tuple. – ggorlen Feb 28 '23 at 19:23
1

Steps for getting fullscreen ( proved in Replit ) :

  1. Get the screen
  2. Get the screen's tkinter root
  3. Set the attribute -fullscreen to True

Code:

import turtle

screen = turtle.Screen()
screenTk = screen.getcanvas().winfo_toplevel()
screenTk.attributes("-fullscreen", True)
RixTheTyrunt
  • 185
  • 3
  • 11
  • Same effect have `screen.getcanvas().master` and `from tkinter import Widget; Widget._nametowidget(screen.getcanvas(), name='.')` . It's the only true fullscreen, but ... with a thin border. So the remaining question is: > **Is there a way to make it borderless fullscreen?** (asked by VanGo Jan 15, 2021 at 7:48). – Claudio Jul 01 '22 at 00:00
  • I don't think so... – RixTheTyrunt Aug 24 '22 at 14:01
0

To get fullscreen, but still have the title bar and buttons use this. Tested.

screen = turtle.Screen()
screenTk = screen.getcanvas().winfo_toplevel()
# maximize window
screenTk.attributes("-zoom", 1)
-1

This works for python 2.7.18 its not a true full screen but its as big as the screen

import turtle

screen = turtle.Screen()

screen.setup(width = 1.0, height = 1.0)
skibee
  • 1,279
  • 1
  • 17
  • 37
Garret
  • 1