Tkinter fullscreen error in Raspberry Pi 64 bits OS

I want to make a tkinter-based GUI in a RaspberryPi. I need it to be on a fullscreen mode. I have the following script:
from tkinter import *

win = Tk()
win.geometry("650x250")
label = Label(win, text="Hello World!", font=('Times New Roman bold', 20))
label.pack(padx=10, pady=10)

# Utiliza wm_attributes para establecer el modo fullscreen
win.wm_attributes('-fullscreen', 'true')

win.mainloop()

I know it will sound stupid, but it only works sometimes (as seen in images). Is there any way to update the necessary libraries or similar? What options do I have?
enter image description here
enter image description here
I’ve been using tkinter for a year and never had such a problem, but I always worked with the 32-bit Raspi OS. Due to a library I need, I must stay with the 64-bit OS.

Thanks!

  • 1

    Running the script runs fine on my machine (but I have x64). Maybe try to run the fullscreen command after some time? e.g. win.after(1000, lambda: win.wm_attributes('-fullscreen', 'true'))

    – 

  • Seems to work “fine”! In the worst of the cases, a minimized window is opened, and it opens after a few time. Thanks!

    – 

  • I’ll post that as an answer. So you can accept it and close this question.

    – 

As a workaround try to make the application fullscreen after some time, e.g.:

Instead:

win.wm_attributes('-fullscreen', 'true')

try:

win.after(1000, lambda: win.wm_attributes('-fullscreen', 'true'))

Leave a Comment