[Python] How do I use threading in pygame, even though I'm not supposed to (or somehow get...

Discussão em 'Python' iniciado por Stack, Maio 18, 2025.

  1. Stack

    Stack Membro Participativo

    I've been working on a project for school, and it involves creating commands to work with other commands (it's for the vex robotics python package if anyone is familiar with it).

    The whole point is to replicate a package that is used for other devices, and make the commands work on a computer instead. I've been creating these duplicates using pygame in python.

    The way I have it working now, is that my program sets up all the functions, and runs a thread to handle events. Then, where the user would normally import it for a different device, it instead imports my program, and uses my functions, and my events.

    Everything is working smoothly, as complicated as it seems.

    The one part that is crashing the entire program, is the thread that is handling events.

    I've tried using threads, multiprocessing, and different combinations of the two, but after doing some research, I've found that pygame just doesn't like threads.

    How do I get around this?? It seems like I need to use a thread, because most player made codes have while True loops in them.

    Continue reading...

Compartilhe esta Página