Мне нужна помощь при подключении дополнительного потока в Tkinter. Мне нужно постоянно обновлять координаты курсора в Label, но я просто не могу понять это (+, если возможно, вы можете сказать мне, как сделать такую конструкцию: "текст", переменная, здесь: Label (text = " Координаты: ", font =" Arial 12 ").
import win32api
from threading import Thread
from tkinter import *
root = Tk()
#Подключение модулей}
#Переменные{
xcoord = "null"
ycoord = "null"
h_x = 0
h_y = 0
#Переменные}
root.title("Utility")
root.geometry("400x500+100+100")
root.columnconfigure(0, weight=1)
root.resizable(False, False)
#root.iconbitmap('') Иконка
root["bg"] = "grey30"
def coordinates():
while True:
h_x, h_y = win32api.GetCursorPos()
print(h_x, h_y)
#Лейбл показа координат{
select_mode = Label(text="Координаты:", font="Arial 12")
select_mode['bg'] = "grey30"
select_mode['fg'] = "white"
select_mode.place(x="10", y="470")
select_mode = Label(text='x = ', font="Arial 12")
select_mode['bg'] = "grey30"
select_mode['fg'] = "white"
select_mode.place(x="120", y="470")
select_mode = Label(text=h_x, font="Arial 12")
select_mode['bg'] = "grey30"
select_mode['fg'] = "white"
select_mode.place(x="140", y="470")
select_mode = Label(text='y = ', font="Arial 12")
select_mode['bg'] = "grey30"
select_mode['fg'] = "white"
select_mode.place(x="200", y="470")
select_mode = Label(text=h_y, font="Arial 12")
select_mode['bg'] = "grey30"
select_mode['fg'] = "white"
select_mode.place(x="220", y="470")
coord_thread = Thread(target = coordinates)
coord_thread.run()
coord_thread.join()
root.mainloop()