Jan-06-2023, 03:56 PM
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!
(Jan-05-2023, 11:42 PM)Yoriz Wrote: The lineroot.mainloop()
is never reached because the code goes into an infinite loop from thewhile True:
up to thetime.sleep(10)
If the GUI was to work with this code thetime.sleep
would freeze the GUI becausemainloop
would not be able to update the GUI until thesleep
finishes.
To get around this rather than usingtime.sleep
, tkinter has anafter
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