#!/usr/pkg/bin/python2.7

import time
from pytemplate import PyTemplate
from pytemplate import ThreadTemplate
from pytemplate import ThreadListTemplate

class MyProgram(PyTemplate):
    def __init__(self):
        PyTemplate.__init__(self)
        pass

    def loadparams(self,args):
	return

    def main(self):
	self.lprint("main program's loop",False)
	myexample=ThreadListTemplate()
	sleeptime=1
	# thread creation
	mythread=amazingthread(sleeptime)
	# thread is added to myexample, list of threads and started
	myexample(mythread,"start")
	time.sleep(5)
	myexample(mythread,"stop")

class amazingthread(ThreadTemplate):
        def __init__(self,sleeptime):
                ''' Initialisation function for the thread. 
                Put your specific initialization here 
                '''
                ThreadTemplate.__init__(self,sleeptime)

        def execute(self):
                ''' Execution function of the thread.
                This function will be called after each sleeptime duration 
                '''
                print "I'm the amazing thread!!"

if __name__ == '__main__':
    prog = MyProgram()
    prog.run()



