I have main program with GUI which redraws vectors.
In this gui program iam fast reading some data and draw them fluently on the canvas.
Problem i, when i calling temperature sensor, becasue he has delay about 1s and every time i read this, my GUI program gets stuck 1s for reading temp sensor data.
How can i solve this problem.
GUI.py
#MAKEING SOME GUI STAFF
from temperature import temp
while True:
print(temp.temperatures())
">>>The temperature is 25 celsius"
#waiting about 1s and stucking GUI.py
">>>The temperature is 25,1 celsius"
#and over and over again .....
temperature.py
from w1thermsensor import W1ThermSensor
sensor = W1ThermSensor()
class temp():
def temperatures():
try:
temperature = sensor.get_temperature()
print("The temperature is %s celsius" % temperature)
return(temperature)
except:
print("error")
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…