J
J
Joni Straponi2022-01-09 19:59:08
Python
Joni Straponi, 2022-01-09 19:59:08

Why isn't the Tkinter text widget updating?

When I try to run a window opens, but the value is not updated, it throws an error (TypeError: 'Label' object is not callable)
Here is the script:

from tkinter import * 
import wmi

window = Tk()
window.title("...")
window.geometry('450x250+1455+5')
window.attributes("-topmost",True)
window.resizable(width=False, height=False)

w = wmi.WMI(namespace="root\\OpenHardwareMonitor")
temperature_infos = w.Sensor()
sl = {}

for sensor in temperature_infos:
  sl[sensor.Name] = sensor.Value

fan_gpu = sl['GPU']	
fan_gpu_info = Label(text= f'{fan_gpu} RPM') 
fan_gpu_info.place(relx=.0, rely=.0)

def fans_gpu():
  sl = {}
  for sensor in temperature_infos:
    sl[sensor.Name] = sensor.Value
  fan_gpu = sl['GPU']
  fan_gpu_info.config(text=f'{fan_gpu} RPM')
  fan_gpu_info.after(1000, fan_gpu_info)

fans_gpu()
window.mainloop()

Previously, this error did not get out (5 days ago).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2022-01-09
@Joni_Straponi

fan_gpu_info.after(1000, fan_gpu_info)
Maybe this was meant?
fan_gpu_info.after(1000, fans_gpu)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question