time 和 tkinter
为什么用到 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()
没问题啊???运行正常 不报错 Twilight6 发表于 2020-6-7 13:54
没问题啊???运行正常 不报错
不报错是不报错……但是要的效果没有啊{:10_266:} Twilight6 发表于 2020-6-7 13:54
没问题啊???运行正常 不报错
先执行sleep……然后insert和delete就只有最后一组会显示,前面的insert和delete都给吃了……{:10_266:} weiter 发表于 2020-6-7 13:56
先执行sleep……然后insert和delete就只有最后一组会显示,前面的insert和delete都给吃了……
刷新下窗口就好了啊
root.update_idletasks()
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()
Twilight6 发表于 2020-6-7 14:01
刷新下窗口就好了啊
啊!这样啊!谢谢
我先试试
页:
[1]