I currently have a button triggering this:
def spam(self,event):
t = workingthread()
t.start()
Which goes to this:
class workingthread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self):
while 1:
chat = skype.CreateChatWith(name)
chat.SendMessage(message)
time.sleep(timeou)
I’m trying to have this be toggled but I’ve heard there’s no way to stop threads and I don’t really want to use multiprocessing. Any other ways i could get this to work without lagging the wx gui?
You could try something like this, which I have done myself.
This is a rough example obviously, but you create a queue that blocks in the thread. You start the thread whenever you want and it runs. It waits for you to trigger it or stop it.