Can python multiprocessing run two same fuctions that makes screen outputs - python

Hello I want to run a function that puts some random dots to paint but I want to make this thing for several times so ı need a multiprocessor but I doubt about it because of that, I use pyautogui to put dots to random coordinates of the paint table. So, I wonder that if I use a multiprocessor, will it just get broke or will it just work fine?
Thanks already to whoever answers this question!

Related

How can I use multiple keys to do one thing in turtle

I am pretty much a beginner at Python and code altogether. I have a raspberry pi to mess around on and I recently got a Trilobot.
I'm trying to set it up so I can control it with a keyboard. I decided to use turtle and have been using things like the code below. I want to be able to go forward and right, but I don't know how to do both of them at the same time by holding w and d.
def forward():
Bot.forward()
wn.onkeypress(forward, “w”)
I don't know if any of that made sense. If it didn't, I'll gladly explain myself to get an answer.

Is there a way to simulate multiple mouse pointers in Python?

Firstly, I am aware of this post and this post here StackOverflow. However, most of the information in these posts is either severely outdated or not applicable to my use case.
I would like to know if it is possible to simulate n mouse pointers with n different instances of Python. That is, I would like to be able to run as many mouse pointers on my screen as possible. All of these mouse pointers would be controlled by the same script, but would still be doing all their work independently of each other.
Is it possible to create such an application using Python?

Python Move Mouse in Active window

Firstly, there are a couple of similar questions posted on this. But they are not complete questions, and no one has really answered them all. I am using Python to send input to a game active in widow modes using "ctypes" package. The original idea is mentioned here
In particular, my codes are:
x=500
y=400
for i in range(10):
time.sleep(4)
if i > 0:
x=x+17
pos=(x,y)
#ctypes.windll.user32.SetCursorPos(x,y) # this does not work in game but
#outside the game window
ctypes.windll.user32.mouse_event(0,x,y,0,0)
print i
In order for the "mouse_event" to work, I tried inputting hexadecimal values but can't get it to move consistently. I tried setting up separate class & functions to import, then calling the function. The function works outside the game window but not inside the game window.
The separate class & functions are based on this question
Thank you for your help in advance.

Odd clicking noise while attempting to play a sound in python

While working on a simple little timer I was creating to simultaneously help me learn more about Python and to help me keep on schedule with my schoolwork; I decided to add a little tune to let me know when your time was up. However, after using the following snippet of code to program each individual note:
winsound.Beep(Freq, Dur)
I realized that whenever I actually played the little song, an odd clicking sound happened between each note. Does anyone know what's going on? Should I use a different expression? Am I just losing my mind?
Edit: Since posting this, I realized what the issue is, the program is waiting about a sixteenth of second in between playing each note. So I'd like to ask another question (any answers relating to the others would still be appreciated), namely, how can I make it not wait in between the notes.
import winsound
winsound.Beep(262,500)
winsound.Beep(277,500)
winsound.Beep(294,500)
winsound.Beep(311,500)
winsound.Beep(330,500)
winsound.Beep(349,500)
winsound.Beep(370,500)
winsound.Beep(392,500)
winsound.Beep(415,500)
winsound.Beep(440,500)
winsound.Beep(466,500)
winsound.Beep(493,500)
winsound.Beep(523,500)
All the above code does is play a simple chromatic scale from middle c to c2, but once one runs it, one would immediately see what Im talking about

Python 2.7 - Completely clear Console, including the input line?

I've tried the solution here - How to clear the interpreter console? - to clear the Console, and it works, but it still leaves the C:/Python27> line. Is there any way of clearing everything, including this? I'm new to Python, I'm trying to make a simple Noughts and Crosses game, for which I want a clear Console. I usually use VB.NET, where there are no input lines and this isn't a problem.
If this was me, I would see if I could perhaps control the size of the window being used, such that I know the exact number of lines on screen, and then print an exact number of blank lines such that the command prompt is not longer shown.
After this point, your noughts and crosses game I assume will print to screen multiple times, where each 'time' is going to be a new 'frame' of your game.

Categories