How should I go about creating a counter that will be decremented when a multiprocessing.process
is decrementing the counter variable from the main process? With the limited C knowledge and programming knowledge I have, I believe a pointer would be very useful here. Is there some equivalent?
For example:
counter = 400
def decrement(counter):
global counter
while counter > 0:
counter = counter - 1
return counter
if __name__ == '__main__':
p = multiprocessing.process(target=decrement(counter))
p.start()
while counter != 0:
print(counter)
...
My goal here is for it to be shown how many "Clicks" are left from a set value for my autoclicker. In the code example, I want it to show it decreasing from 400 to 0. Please let me know if this is possible in the current implementation chosen. I'd put a image of my autoclicker below but unfortunately I don't have enough "reputation" to post it.
Edit:
I've tried using Value
from the multiprocessing
library as well as Queue
to send over the information, but the problem is I need a thread to update the variable while the process is running. It would be mighty convenient to have the process have access to the variable so it can update it directly.