Jun-08-2017, 01:14 AM
Hello all, i haven't messed with python for a couple of years, so im very rusty. Im messing with a gui i started making for another project, now i need it for something else. Im pretty sure the way i did this with self.root makes the window as big as the text, so i just need to add text after the temperature reading, that way the temperature reading says "Inside Temp" after it prints the temp. Here is the code im working with;
import Tkinter as tk master = tk def temp(): tfile = open("/sys/bus/w1/devices/28-000006c51ea2/w1_slave") text = tfile.read() tfile.close() secondline = text.split("\n")[1] temperaturedata = secondline.split(" ")[9] temperature = float(temperaturedata[2:]) temperature = temperature / 1000 * 9.0 / 5.0 +32 temperature = round(temperature, 2) return temperature class App(): def __init__ (self) : self.root = tk.Tk() self.root.title("auto") self.label = tk.Label(text="") self.label.pack() self.update_clock() self.root.mainloop() def update_clock(self): self.label.configure(text=temp()) self.root.after(3000, self.update_clock) app = App()Any help is appreciated. Thank you.