Python can';t调用;wm";命令:应用程序已被销毁

Python can';t调用;wm";命令:应用程序已被销毁,python,tkinter,Python,Tkinter,请理解,即使源代码是肮脏的 我想要的是图像跟随鼠标 我试图通过重复图像消失和出现来跟随鼠标,但这并不容易。这里。我让图像跟随鼠标,没有pyautogui 代码: 将tkinter作为tk导入 从tkinter进口* #导入pyautogui root=tk.tk() #label=tk.label(root,text='you coomand hacking',font=('Times New Roman','80'),fg='black',bg='white') #label.pack() 根

请理解,即使源代码是肮脏的

我想要的是图像跟随鼠标


我试图通过重复图像消失和出现来跟随鼠标,但这并不容易。

这里。我让图像跟随鼠标,没有
pyautogui

代码:

将tkinter作为tk导入
从tkinter进口*
#导入pyautogui
root=tk.tk()
#label=tk.label(root,text='you coomand hacking',font=('Times New Roman','80'),fg='black',bg='white')
#label.pack()
根标题(“墙纸”)
墙=照片图像(文件=“20170227180026_3.gif”)
c=画布(根,高度=1200,宽度=1200)
c、 包()
pic=c.创建_图像(600600,图像=墙)
def movepic(事件):
x、 y=事件.x,事件.y
c、 坐标(图,x,y)
c、 bind_all(“,movepic)
root.mainloop()
mainloop()
返回时,tkinter应用程序已关闭-因此无需销毁它。读取
import tkinter as tk
from tkinter import *
import pyautogui
root = tk.Tk()
#label = tk.Label(root, text='you coomand hacking', font=    ('Times New Roman','80'), fg='black', bg='white')
#label.pack()
root.title("Wallpaper") 

wall = PhotoImage(file = "20170227180026_3.gif") 
wall_label = Label(image = wall)
root.geometry(f"{wall.width()}x{wall.height()}")     
root.overrideredirect(True)
currentMouseX,currentMouseY = pyautogui.position()
print(f'{currentMouseX} {currentMouseY}')
root.geometry("+0+0")
root.wm_attributes("-topmost", True)
root.wm_attributes("-disabled", True)
root.wm_attributes("-transparentcolor", "white")
wall_label.place(x = -2,y = -2)
root.after(1000 , root.destroy)
#root.geometry("+{}+{}".format(currentMouseX,currentMouseY))
root.geometry("+{}+{}".format(currentMouseX,currentMouseY))
root.mainloop()
root.after(1000 , root.destroy)
root.geometry("+{}+{}".format(currentMouseX,currentMouseY))