1、时间序列
(1)点击位置输出
from tkinter import *
root=Tk()
def callback(event):
print(“点击位置”,event.x,event.y)
frame=Frame(root,width=200,height=200)
frame.bind(’’,callback)
frame.pack()
mainloop()
(2)键盘输入
from tkinter import *
root=Tk()
def callback(event):
print(event.char)
frame=Frame(root,width=200,height=200)
frame.bind(’’,callback)
frame.focus_set()
frame.pack()
mainloop()
(3)Motion用法
from tkinter import *
root=Tk()
def callback(event):
print(“当前位置:”,event.x,event.y)
frame=Frame(root,width=200,height=200