Python Forum
TKinter Not Executing
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TKinter Not Executing
#3
Smile 
Yoriz... thanks so much for the great explanation on this. I am still quite new with Python, so this is a great learning experience. This seems to be working perfectly and I do not notice any freezing yet with the GUI. Thanks again, very much appreciated! Smile

(Jan-05-2023, 11:42 PM)Yoriz Wrote: The line root.mainloop() is never reached because the code goes into an infinite loop from the while True: up to the time.sleep(10)

If the GUI was to work with this code the time.sleep would freeze the GUI because mainloop would not be able to update the GUI until the sleep finishes.

To get around this rather than using time.sleep, tkinter has an after method that will call a function after a number of milliseconds.
Here is the code with the addition of after but I can't test it as I don't have the bme280, smbus2 etc
Reply


Messages In This Thread
TKinter Not Executing - by Nu2Python - Jan-05-2023, 10:24 PM
RE: TKinter Not Executing - by Yoriz - Jan-05-2023, 11:42 PM
RE: TKinter Not Executing - by Nu2Python - Jan-06-2023, 03:56 PM
RE: TKinter Not Executing - by Vadanane - Jan-31-2023, 10:04 AM

Forum Jump:

User Panel Messages

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