python - 在后台运行计数器

标签 python pydroid

我正在尝试创建一个升级者/大亨游戏,并意识到要让钱不断增加,我将不得不启动一个不同的过程,这样我就可以拥有我的 GUI,它可以在钱增加时使用,而不会停止另一个从工作中。

最好的方法是什么?

我浏览过这个网站,但没有找到任何对我有帮助的东西!

(如果您需要更多信息,请告诉我!)

最佳答案

使用线程。

Python 有一个名为 threading 的模块,您需要

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

我在同一主题中的旧答案:Here 。 如果您考虑在您的问题中添加一些代码,我很乐意在线程中提供帮助!另外,如果您在设计代码时需要帮助,请随时询问,线程可能会很困惑。

关于python - 在后台运行计数器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63067235/

相关文章:

python - 使用 mod_wsgi 导入 python 模块

python - Django:如何为模型实例预取相关内容。也许通过包装在查询集中?

python - 导入 matplotlib 时 pydroid 显示终端

Android 上的 Python 应用程序 : running through PyDroid is twice faster than compiled app via Buildozer! 为什么?

android - Android : how to see graph? 上带有 Pydroid 3 的 Matplotlib

python - Python 函数调用超时

Python while 循环没有按预期工作

python - Tkinter create_line问题: wrong # coordinates: expected an even number

android - 在 Pydroid 3 终端中安装 Git