multithreading - How to stop one thread with another python -


i creating game gives twenty seconds enter input. have learned way multi threading , learned how create multiple threads goal being 1 thread ask input , other time. problem ran 1 thread can't terminate , can't find way make main thread either. there way don't know about? i'm pretty new threads , python if there obvious way, don't know it. program far:

import _thread import time  def askforinput():    input(">")  def time(time):    time.sleep(time)    #terminate first thread  _thread.start_new_thread(print_time,()) _thread.start_new_thread(time,(20))  while 1:    pass 

it fine either timing thread or input thread main program too. if there way without threading, i'm open, that's best way think of.


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -