What I am trying to do is make something that tracks the mouse's position.
from pyautogui import position #using as mouse tracker
from tkinter import *
from playsound import playsound #using this later
from time import sleep #delay
root = Tk()
root.geometry("1000x500")
def loop():
label = Label(root, text=str(position()))
label.pack()
sleep(0.01)
loop()
root.mainloop()
When I run it it displays the position that the mouse was first in. If I run:
from pyautogui import *
from tkinter import *
from playsound import playsound
from time import sleep
root = Tk()
root.geometry("1000x500")
a = 1
while a == 1:
label = Label(root, text=str(position())
label.pack()
time.sleep(0.01)
root.mainloop()
It runs a blank tkinter window. How can I make it actively change to match where the position is?