马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
为什么用到 time 的那一段出问题啊……
from pyautogui import *
from tkinter import *
import time
root = Tk()
def get_place():
entry_place.delete(0, END)
entry_place.insert(0, "3")
time.sleep(1)
entry_place.delete(0, END)
entry_place.insert(0, "2")
time.sleep(1)
entry_place.delete(0, END)
entry_place.insert(0, "1")
time.sleep(1)
entry_place.delete(0, END)
now_place = position()
entry_place.insert(END, now_place)
label_first = Label(root,text="鼠标位置:")
label_first.grid(row=0, column=0)
entry_place = Entry(root)
entry_place.grid(row=0, column=1)
button_get = Button(root, text="获取鼠标位置", command=get_place)
button_get.grid(row=1, column=0, columnspan=2)
mainloop()
刷新下窗口就好了啊from pyautogui import *
from tkinter import *
import time
root = Tk()
def get_place():
entry_place.delete(0, END)
entry_place.insert(0, "3")
root.update_idletasks()
time.sleep(1)
entry_place.delete(0, END)
entry_place.insert(0, "2")
root.update_idletasks()
time.sleep(1)
entry_place.delete(0, END)
entry_place.insert(0, "1")
root.update_idletasks()
time.sleep(1)
entry_place.delete(0, END)
now_place = position()
entry_place.insert(END, now_place)
label_first = Label(root,text="鼠标位置:")
label_first.grid(row=0, column=0)
entry_place = Entry(root)
entry_place.grid(row=0, column=1)
button_get = Button(root, text="获取鼠标位置", command=get_place)
button_get.grid(row=1, column=0, columnspan=2)
mainloop()
|