Changing mouse cursor in Blender

One of the common hints to get the user attention when performing certain actions is the changed appearance of the mouse pointer. In Blender, using the Python API, we can set the desired view for the cursor when we need.

To change the mouse cursor we need to call the cursor_set() function of the bpy.types.Window object. The desired type of the cursor is passed to the parameter of this function.

For example, to change the cursor to the “hand” image, we need to call this function with the “HAND” parameter:

All possible cursor forms are defined by the following list of parameters: NONE, WAIT, CROSSHAIR, MOVE_X, MOVE_Y, KNIFE, TEXT, PAINT_BRUSH, PAINT_CROSS, DOT, ERASER, HAND, SCROLL_X, SCROLL_Y, SCROLL_XY, EYEDROPPER, PICK_AREA, STOP, COPY, CROSS, MUTE, ZOOM_IN, ZOOM_OUT.

To return the cursor to its normal form, we need to call this function with the DEFAULT parameter:

To change the appearance of the cursor during the execution of the modal operator, the cursor_modal_set() function is used with the same set of parameters.

For example for the “hand” cursor:

To return to the common form of the cursor after the completion of the modal operator, we need to call the cursor_modal_restore () function:

3 2 votes
Article Rating
Subscribe
Notify of
guest

0 Comment
Inline Feedbacks
View all comments