2014-07-03, 17:23
Hi all,
I need some help regarding how to kill or terminate the thread. I can be able to open the thread when I hit the enter button of the keyboard, but I can't be able to find out how to kill or terminate the thread when I hit the backspace button.
Here is the code:
Do you know how I can kill or terminate the thread when I hit the backspace button?
What method do I need to use to kill or terminate the thread?
I have try to find the answer on google, but unfortunately I can't find the answer.
Any advice would be much appreciated.
I need some help regarding how to kill or terminate the thread. I can be able to open the thread when I hit the enter button of the keyboard, but I can't be able to find out how to kill or terminate the thread when I hit the backspace button.
Here is the code:
Code:
import urllib2
import StringIO
import threading
ACTION_ENTER = 7
ACTION_BACKSPACE = 110
def allchannels_timer(self):
for i in range(1):
time.sleep(0.3)
self.getControl(4202).setLabel("0%")
#DOWNLOAD THE XML SOURCE HERE
url = ADDON.getSetting('allchannel.url')
req = urllib2.Request(url)
response = urllib2.urlopen(req)
data = response.read()
response.close()
if action == ACTION_BACKSPACE:
if img1_yellow == False:
self.getControl(4202).setLabel("")
#cancel the connection and close the database
if action == ACTION_ENTER:
if img1_yellow == True:
self.thread = threading.Thread(target=self.allchannels_timer)
self.thread.setDaemon(True)
self.thread.start()
Do you know how I can kill or terminate the thread when I hit the backspace button?
What method do I need to use to kill or terminate the thread?
I have try to find the answer on google, but unfortunately I can't find the answer.
Any advice would be much appreciated.