root.overrideredirect and <Any-KeyPress> binding root.overrideredirect and <Any-KeyPress> binding tkinter tkinter

root.overrideredirect and <Any-KeyPress> binding


Try this:

from tkinter import *root = Tk()root.bind('<Any-KeyPress>', quit())root.mainloop()

Assuming that you want the program to quit, keep the code. If you just want to clear the screen, just use root.destroy() rather that quit(). Using root.overrideredirect(True) will NOT work on Ubuntu.