I'm doing this in python, in case that changes anything.

I'm trying to make a lamp/bit go 1-0-1-0 until the user says "okay" the "okay" should indicate that the user has found the lamp/Bit IRL.

Now i'm struggling to find a way to ask the user a question, (because it stops the program cycle), when I also want the lamp bit to go On/Off on repeat, while waiting for the user to write yes or click yes

Atm i'm looking at this idea

def click(x, y):
    win32api.SetCursorPos((x, y))
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y, 0, 0)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0)

newLampsadded = int(input( " How many new lamps : " ))
lamps = newLampsadded - 1

for lamp in range(lamps):
    while feedback is not "y":
        Click(x, y)              #On
        Click(x+50, y+10)        #Off
        feedback = input("have you found the lamp y/n") #Is the lamp found

anyway i can get a feedback that doesnt stop the cycle of turning the lamp On/Off



I'm not immediately familiar with the Win32API, but you're going to need to multi-thread this application. Because the for loop for the click needs to happen at the same time as your input (which is a blocking call) it needs to happen on a different thread.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.