#!/usr/bin/env python3

import tkinter as tk

def on_escape(event=None):
    print("escaped")
    root.destroy()

root = tk.Tk()

#root.overrideredirect(True)  # sometimes it is needed to toggle fullscreen
                              # but then window doesn't get events from system
#root.overrideredirect(False) # 

root.attributes("-fullscreen", True) # run fullscreen
root.wm_attributes("-topmost", True) # keep on top
#root.focus_set() # set focus on window

root.bind("<Escape>", on_escape)

# close window after 5s if `ESC` will not work
root.after(5000, root.destroy) 

root.mainloop()

332fd0cb1eab44cff42329e0b23118351cbd107b
<mask token>

<mask token>


def on_escape(event=None):
    print('escaped')
    root.destroy()


<mask token>
root.attributes('-fullscreen', True)
root.wm_attributes('-topmost', True)
root.bind('<Escape>', on_escape)
root.after(5000, root.destroy)
root.mainloop()

<mask token>


def on_escape(event=None):
    print('escaped')
    root.destroy()


root = tk.Tk()
root.attributes('-fullscreen', True)
root.wm_attributes('-topmost', True)
root.bind('<Escape>', on_escape)
root.after(5000, root.destroy)
root.mainloop()

import tkinter as tk


def on_escape(event=None):
    print('escaped')
    root.destroy()


root = tk.Tk()
root.attributes('-fullscreen', True)
root.wm_attributes('-topmost', True)
root.bind('<Escape>', on_escape)
root.after(5000, root.destroy)
root.mainloop()

#!/usr/bin/env python3

import tkinter as tk

def on_escape(event=None):
    print("escaped")
    root.destroy()

root = tk.Tk()

#root.overrideredirect(True)  # sometimes it is needed to toggle fullscreen
                              # but then window doesn't get events from system
#root.overrideredirect(False) # 

root.attributes("-fullscreen", True) # run fullscreen
root.wm_attributes("-topmost", True) # keep on top
#root.focus_set() # set focus on window

root.bind("<Escape>", on_escape)

# close window after 5s if `ESC` will not work
root.after(5000, root.destroy) 

root.mainloop()
