Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Updating labels
#1
Hello,

I am trying to make a Gui with 2 labels that shows the live measurements of the sensors(DS18B20) that I have attached to a raspberry. The problem is that it wont't update the values it just shows the first values it has measured.
I hope someone can help me,
thanks in advance


this is the code that I am using.

root = tk.Tk()
canvas = tk.Canvas(root, width=600, height=420, background="Black")
canvas.pack()
canvas.create_image(400, 240)

sensor1, sensor2 = W1ThermSensor.get_available_sensors()

temperatuur = sensor1.get_temperature()
temperatuur2 = sensor2.get_temperature()

Label3 = Label(text=temperatuur)
Label3_window = canvas.create_window(100, 100, anchor="nw", window=Label3)

Label4 = Label(text=temperatuur2)
Label4_window = canvas.create_window(200, 200, anchor="nw", window=Label4)


root.mainloop()
Reply


Messages In This Thread
Updating labels - by Wenkar7000 - Oct-20-2020, 06:38 AM
RE: Updating labels - by Larz60+ - Oct-20-2020, 10:00 AM
RE: Updating labels - by DeaD_EyE - Oct-20-2020, 10:49 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020