0

I am writing a small python game using ncurses. I want to display a count down timer continuously and also take user input simultaneously.

In main function, I created one thread that displays the countdown timer and then put one loop which takes input from user.

Problem : When the player says "quit" the game doesnt quit, the game ends only after the timer thread count downs till zero. How to kill that timer thread in between ?

1 Answer 1

1

Mark your timer thread as daemon, that is set

thread.daemon = True

(where thread is your timer thread object) before calling thread.start().

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.