1

I have this dicT in my code that contain some positions.

position = ['712,352', 
            '712,390', 
            '622,522'] 

when I'm trying to run this part

def MouseMove(x,y):
    ctypes.windll.user32.SetCursorPos(x,y)

with MouseMove(position[0]), the compiler says to me that I need 2 arguments on this command... how can I solve this?

3
  • 4
    position is a list, not a dictionary. Commented Aug 6, 2010 at 18:36
  • Also, it's dict, not dic. I feel like a dick for pointing that out, but it might save you some unfortunate misunderstandings. :) Commented Aug 6, 2010 at 18:45
  • -1: It's not a dictionary in the first place. The question makes no sense. Commented Aug 6, 2010 at 18:51

1 Answer 1

5

It's not a dictionary but a list. Perhaps you mean to do something like this:

position = [(712,352), 
            (712,390), 
            (622,522)]

MouseMove(*position[0])
Sign up to request clarification or add additional context in comments.

3 Comments

That's still one argument. You want MouseMove(*position[0])
@Shady: it takes the item position[0] as a sequence and uses it as arguments to the function call. position[0] was a tuple of two ints so it effectively called MouseMove() with those two as arguments.
@Shady: It's probably how I would have coded it myself (if that means anything). I wouldn't know if it's the best but it is certainly fine in my eyes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.