My team is trying to make multithreading possible in our code, but other responses in forums feature C++. I tried using Python’s official page, but it didn’t work, we are kind of stuck here. Any tips?
brain = Brain()
def thread_a():
count = 0
brain.screen.set_pen_color(Color.YELLOW)
while True:
brain.screen.print_at("%5d"%count, x=10, y=20)
count += 1
sleep(100)
def thread_b():
count = 0
brain.screen.set_pen_color(Color.GREEN)
while True:
brain.screen.print_at("%5d"%count, x=100, y=20)
count += 2
sleep(100)
Thread(thread_a)
Thread(thread_b)
10 Likes