Infinite While True Loop in the Background (Python)
--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game Looping
--
Chapters
00:00 Infinite While True Loop In The Background (Python)
00:26 Accepted Answer Score 17
00:40 Thank you
--
Full question
https://stackoverflow.com/questions/3825...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #multithreading #backgroundprocess
#avk47
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game Looping
--
Chapters
00:00 Infinite While True Loop In The Background (Python)
00:26 Accepted Answer Score 17
00:40 Thank you
--
Full question
https://stackoverflow.com/questions/3825...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #multithreading #backgroundprocess
#avk47
ACCEPTED ANSWER
Score 17
Try multithreading.
import threading
def background():
while True:
number = int(len(oilrigs)) * 49
number += money
time.sleep(1)
def foreground():
# What you want to run in the foreground
b = threading.Thread(name='background', target=background)
f = threading.Thread(name='foreground', target=foreground)
b.start()
f.start()