#coding=utf-8 from tkinter import * root=Tk() def callback(event): print("点击键盘",repr(event.char)) frame=Frame(root,width=200,height=200) frame.bind("<Key>",callback) frame.focus_set() frame.pack() mainloop()
效果图:
#coding=utf-8 from tkinter import * root=Tk() def callback(event): print("点击键盘",repr(event.char)) frame=Frame(root,width=200,height=200) frame.bind("<Key>",callback) frame.focus_set() frame.pack() mainloop()
效果图:
转载于:https://www.cnblogs.com/sea-stream/p/10989679.html