win32api.SetCursorPos() question

Gary Richardson garyr at fidalgo.net
Sat Sep 18 16:41:31 EDT 2004


"vincent wehren" <vincent at visualtrans.de> wrote in message
news:cihmfj$3r8$1 at news5.zwoll1.ov.home.nl...
> Gary Richardson wrote:
> > I'm trying to use win32api.SetCursorPos() to position the cursor in a
> > Tkinter canvas window. I.e.:
> >
> > from Tkinter import *
> > import win32api
> > root = Tk()
> > canvas = Canvas(root,  width=400, height=300, bg='white')
> > canvas.pack()
> > win32api.SetCursorPos(100,100)
> > root.mainloop()
> >
> > But this code produces:
> >
> > Traceback (most recent call last):
> >   File
> >
"C:\Python22\Lib\site-packages\Pythonwin\pywin\framework\scriptutils.py",
> > line 301, in RunScript
> >     exec codeObject in __main__.__dict__
> >   File "C:\My Documents\Python\Ascii\Script4.py", line 6, in ?
> >     win32api.SetCursorPos(100,100)
> > TypeError: SetCursorPos() takes exactly 1 argument (2 given)
> >
> > Am I using this function incorrectly? A search on Google didn't turn up
much
> > but I did find one bit of code in which it was used in this manner.
> >
> > I suspect there may be other problems with this approach so any further
> > comments will be appreciated also. I'm using ActivePython 2.2.2 build
224 on
> > Win98SE.
> >
>
> Different then what the docs say, this function seems to want a tuple as
> argument. See if win32api.SetCursorPos((100,100)) does the trick.
>
> --
> Vincent Wehren

I tried that. It doesn't produce an error but no cursor appears.





More information about the Python-list mailing list