text stays on screen

so I have the following code.

def setText(textEntered):
	if textEntered == "tell me a joke":
		
		joke = OnscreenText(text = 'Humor is not known on my planet!', pos = (-0.8, 0.02), scale = 0.07)
		def unrender (task):
			joke.hide()
		taskMgr.doMethodLater	
	if textEntered == "i did not make you to have coffee breaks":
		print 'Well event I need coffee every now an then.'
	if textEntered == "where am i monday to friday":
		print 'At school learning to make me :)'
	if textEntered == "":
		print 'Such text may confuse wow.'
	if textEntered == "why were you created":
		print 'I was made to serve you, to help you!'
	if textEntered == "how old are you":
		print 'I am a week old.'
	if textEntered == "how are you":
		print 'Fine what about you?'
	if textEntered == "i am fine":
		print 'good to hear :)'
	b.enterText('')

 
#clear the text
def clearText():
	b.enterText('')
 
#add button
b = DirectEntry(text = "" ,scale=.16,command=setText,
initialText="Type Something", numLines = 2,focus=1,focusInCommand=clearText)


run()

Why does the text stay?

taskMgr.doMethodLater

is just link on the method, you should use

taskMgr.doMethodLater(my_delay_time, unrender, 'hide-my-input')

instead