# delay 6s
import time
time.sleep(4)
# after 30 seconds, "hello, world" will be printed
def hello():
print "hello, world"
t = Timer(30.0, hello)
t.start()
# Start a function ina tread;
t = Thread(target = mail,args=(emailTo ,subject,emailText, filePath))
t.start()
# getting data out of a tread
#https://www.derivative.ca/Forum/viewtopic.php?f=4&t=11395#
from threading import Thread, Lock
TEXT = None
TEXT_LOCK = Lock()
def poll():
text = None
with TEXT_LOCK:
text = TEXT
if text is not None:
op('text').text = text
op('polltimer').par.initialize.pulse()
def network_op():
Thread(target=network_op_sync).start()
def network_op_sync():
global TEXT
resp = requests.post(...)
if resp.ok:
with TEXT_LOCK:
TEXT = resp.text