Search code examples
pythontkinterfullscreenraspberry-pi4

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!


Solution

  • 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'))