Hi guys hope you are doing well, please help me i have this simple program you can try and run it that prints as output the hexadecimal value of the colour that the cursor is pointing, but the windows doesn't even get created
import PIL.ImageGrab
from tkinter import *
from pynput.mouse import Controller, Listener
window = Tk()
window.title("Colore in esadecimale")
window.call('wm', 'iconphoto', window._w, PhotoImage(file="trasparente.png"))
window.geometry("500x250")
window.resizable(width=False, height=False)
window.configure(bg="#3C3F41")
etichetta_titolo_valore = Label(window,text="Valore",font=("Ink Free",20),bg="#3C3F41",fg="white")
etichetta_titolo_valore.pack(pady=(20,0))
etichetta_valore = Label(window,text="ciao",font=("Ink Free",20),bg="#3C3F41",fg="white")
etichetta_valore.pack(pady=(10,0))
def mouse_move(x, y):
try:
rgb = PIL.ImageGrab.grab().load()[x, y]
rgb = '#%02x%02x%02x' % (rgb)
rgb = rgb.upper()
print(rgb)
except(IndexError):
pass
with Listener (on_move = mouse_move) as listener:
listener.join()
window.mainloop()