LtqxWYEG / ShitStuckToYourMouse

Draws mouse-cursor-following particles, text, cursor coordinates, color of pixel under cursor, pictures or a clock - for when you really need to keep an eye on the time. Uses PyGame for low resource usage. Works by creating a transparent full-screen window that is click-through, on top of the z-order.
18 stars 1 forks source link

[0.17-beta] When compiled to exe: Random errors occur sometimes when sparkles subprocesses are started too fast after each other. (For multithreading) #4

Open LtqxWYEG opened 2 weeks ago

LtqxWYEG commented 2 weeks ago

My multithreading solution causes n subprocesses of sparkles to spawn. This happens too fast when it's all compiled to a executable; Random errors occur that are seemingly related to how much time the program had to run through before the next subprocess was started.

I had to add a 1.5 second delay between launches of the sparkles subprocesses. This is annoying, but barely noticable when there are only 2 - which is the best anyway for up to a medium amount of particles.
So this seems to be a sufficient work-around until I figure out what really the problem is. It's never what I think it is.

if isCompiledToExe:
    returnValue = Popen("sparkles.exe", shell=False, creationflags=CREATE_NO_WINDOW, cwd=getcwd())
    proc.append(returnValue)
    if numberTasks > 1:
        sleep(1.5)  # random errors occur when running multiple exe at the same time. Sleep does help

Any Ideas?