Search code examples
pythonpydroid

Run a counter in the background


Im trying to create an upgrader/tycoon game and realised to have the money continuously going up, I would have to start a different process so I can have my GUI which can be used as the money goes up without either stopping the other from working.

What is the best way to do this?

I've looked around on this site and nothing I could find has helped me!

(If you need any more information just let me know!)


Solution

  • Use threading.

    Python has a module named threading, and you need

    threading.Thread(target=somefunc).start()
    

    My old answer in the same topic: Here. If you consider adding some code to your question, I am happy to help in threading! Also, if you need help in designing the code, feel free to ask, threads can be messy.