views:

61

answers:

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?

+5  A: 

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])
Jeff M
now worked =), what the * did?
Shady
That's still one argument. You want MouseMove(*position[0])
pilcrow
@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.
Jeff M
thanks Jeff.... This is the better way to do this that I am doing?
Shady
@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.
Jeff M