check for button pressed python code example
Example: how to detect button presses in python
from tkinter import *
def doSomething(event):
#print("You pressed: " + event.keysym)
label.config(text=event.keysym)
window = Tk()
window.bind("<Key>",doSomething)
label = Label(window,font=("Helvetica",100))
label.pack()
window.mainloop()