How can I use a large wxCursor?

42 views
Skip to first unread message

Toni Ruža

unread,
Feb 15, 2010, 1:16:17 PM2/15/10
to wxPython-users
The wx.Cursor class automatically scales the image I give it to 32x32
and I need to use a cursor that is larger than that.

On http://support.microsoft.com/kb/307213 I saw what might be the
reason for this behavior

> Although cursors can, in theory, be
> any size, the system imposes a
> standard size that is exposed by
> means of the SM_CXCURSOR and
> SM_CYCURSOR values. These metrics are
> read-only. On standard, low-DPI
> systems, these metrics are set to
> 32x32 pixels (32 bytes/row). When the
> system loads cursors by means of the
> standard LoadCursor function, the
> cursor is stretched to this dimension.

but I also saw that it can be done

> The system also provides the
> SetSystemCursor API function that you
> can use to change the system cursor
> for specific categories. You can use
> this function to set a cursor of any
> size. However, you must call the
> function programmatically, and you can
> only use it to set a cursor for a
> specific category. You cannot use it
> to make all cursors on the system the
> same size.


Is there something I am missing in the wx docs or must I directly call
the windows api?

Mike Driscoll

unread,
Feb 15, 2010, 5:22:18 PM2/15/10
to wxpytho...@googlegroups.com
Hi Toni,


--



Did you try SetSize((x, y)) or SetHeight() and SetWidth()? If those don't work, then calling it with the windows api or with ctypes may be the way to go.



--
-----------------
Mike Driscoll

Blog:   http://blog.pythonlibrary.org

Toni Ruža

unread,
Feb 16, 2010, 2:09:48 AM2/16/10
to wxPython-users

> Did you try SetSize((x, y)) or SetHeight() and SetWidth()?

Tried them to no effect, and anyway the scaling takes place during the
construction of the object so even if it worked this way the two
scaling operations would probably distort the already low resolution
image.


> If those don't
> work, then calling it with the windows api or with ctypes may be the way to
> go.

It looks like it. Since I need this cursor over an OpenGL canvas I've
also considered hiding the cursor and drawing the bigger image on the
canvas in its place, but I would rather like to avoid refreshing the
canvas that often. If the windows api way turns out too inconvenient
or if I don't get any other ideas from here I'll probably do it that
way.


Thanks

Robin Dunn

unread,
Feb 16, 2010, 2:50:33 AM2/16/10
to wxpytho...@googlegroups.com
On 2/15/10 10:16 AM, Toni Ru�a wrote:
> Is there something I am missing in the wx docs or must I directly call
> the windows api?
>

wx doesn't do anything special to support non standard sized cursors.

--
Robin Dunn
Software Craftsman
http://wxPython.org

Reply all
Reply to author
Forward
0 new messages