this is because you are not wrapping it in a window, but printing it in a python shell.
you should replace this print newtextwith:
w = Label(root, text=newtext)
w.pack()
working code should look like this:
import Adafruit_DHT as dht
import time
from Tkinter import *
root = Tk()
k= StringVar()
num = 1
thelabel = Label(root, textvariable=k)
thelabel.pack
def READ():
h,t = dht.read_retry(dht.DHT22, 4)
newtext = "Temp=%s*C Humidity=%s" %(t,h)
k.set(str(newtext))
w = Label(root, text=newtext)
w.pack()
def read30seconds():
READ()
root.after(30000, read30seconds)
read30seconds()
root.mainloop()
, , .
, tkinter
tkinter, tkinter
, , , destroy() , :
import Adafruit_DHT as dht
import time
from Tkinter import *
root = Tk()
k= StringVar()
num = 1
thelabel = Label(root, textvariable=k)
thelabel.pack
def READ():
global w
h,t = dht.read_retry(dht.DHT22, 4)
newtext = "Temp=%s*C Humidity=%s" %(t,h)
k.set(str(newtext))
print newtext
def read30seconds():
READ()
try: w.destroy()
except: pass
root.after(30000, read30seconds)
read30seconds()
root.mainloop()