gtk.gdk.Cursor
Prev | The gtk.gdk Class Reference | Next

## gtk.gdk.Cursor

gtk.gdk.Cursor — standard and pixmap cursors

## Synopsis

    class gtk.gdk.Cursor(gobject.GBoxed):
        gtk.gdk.Cursor(cursor_type)
        gtk.gdk.Cursor(display, cursor_type)
        gtk.gdk.Cursor(display, pixbuf, x, y)
        gtk.gdk.Cursor(source, mask, fg, bg, x, y)
        def get_display()

## Description

A `gtk.gdk.Cursor` represents a bitmap image used for the mouse pointer. Each `gtk.gdk.Window` can have its own cursor. By default a `gtk.gdk.Window` uses its parent's cursor. A standard set of cursors is provided in `PyGTK`:

`gtk.gdk.X_CURSOR` |
`gtk.gdk.ARROW` |
`gtk.gdk.BASED_ARROW_DOWN` |
`gtk.gdk.BASED_ARROW_UP` |
`gtk.gdk.BOAT` |
`gtk.gdk.BOGOSITY` |
`gtk.gdk.BOTTOM_LEFT_CORNER` |
`gtk.gdk.BOTTOM_RIGHT_CORNER` |
`gtk.gdk.BOTTOM_SIDE` |
`gtk.gdk.BOTTOM_TEE` |
`gtk.gdk.BOX_SPIRAL` |
`gtk.gdk.CENTER_PTR` |
`gtk.gdk.CIRCLE` |
`gtk.gdk.CLOCK` |
`gtk.gdk.COFFEE_MUG` |
`gtk.gdk.CROSS` |
`gtk.gdk.CROSS_REVERSE` |
`gtk.gdk.CROSSHAIR` |
`gtk.gdk.DIAMOND_CROSS` |
`gtk.gdk.DOT` |
`gtk.gdk.DOTBOX` |
`gtk.gdk.DOUBLE_ARROW` |
`gtk.gdk.DRAFT_LARGE` |
`gtk.gdk.DRAFT_SMALL` |
`gtk.gdk.DRAPED_BOX` |
`gtk.gdk.EXCHANGE` |
`gtk.gdk.FLEUR` |
`gtk.gdk.GOBBLER` |
`gtk.gdk.GUMBY` |
`gtk.gdk.HAND1` |
`gtk.gdk.HAND2` |
`gtk.gdk.HEART` |
`gtk.gdk.ICON` |
`gtk.gdk.IRON_CROSS` |
`gtk.gdk.LEFT_PTR` |
`gtk.gdk.LEFT_SIDE` |
`gtk.gdk.LEFT_TEE` |
`gtk.gdk.LEFTBUTTON` |
`gtk.gdk.LL_ANGLE` |
`gtk.gdk.LR_ANGLE` |
`gtk.gdk.MAN` |
`gtk.gdk.MIDDLEBUTTON` |
`gtk.gdk.MOUSE` |
`gtk.gdk.PENCIL` |
`gtk.gdk.PIRATE` |
`gtk.gdk.PLUS` |
`gtk.gdk.QUESTION_ARROW` |
`gtk.gdk.RIGHT_PTR` |
`gtk.gdk.RIGHT_SIDE` |
`gtk.gdk.RIGHT_TEE` |
`gtk.gdk.RIGHTBUTTON` |
`gtk.gdk.RTL_LOGO` |
`gtk.gdk.SAILBOAT` |
`gtk.gdk.SB_DOWN_ARROW` |
`gtk.gdk.SB_H_DOUBLE_ARROW` |
`gtk.gdk.SB_LEFT_ARROW` |
`gtk.gdk.SB_RIGHT_ARROW` |
`gtk.gdk.SB_UP_ARROW` |
`gtk.gdk.SB_V_DOUBLE_ARROW` |
`gtk.gdk.SHUTTLE` |
`gtk.gdk.SIZING` |
`gtk.gdk.SPIDER` |
`gtk.gdk.SPRAYCAN` |
`gtk.gdk.STAR` |
`gtk.gdk.TARGET` |
`gtk.gdk.TCROSS` |
`gtk.gdk.TOP_LEFT_ARROW` |
`gtk.gdk.TOP_LEFT_CORNER` |
`gtk.gdk.TOP_RIGHT_CORNER` |
`gtk.gdk.TOP_SIDE` |
`gtk.gdk.TOP_TEE` |
`gtk.gdk.TREK` |
`gtk.gdk.UL_ANGLE` |
`gtk.gdk.UMBRELLA` |
`gtk.gdk.UR_ANGLE` |
`gtk.gdk.WATCH` |
`gtk.gdk.XTERM` |

## Constructor

        gtk.gdk.Cursor(cursor_type)

`cursor_type` : | the standard cursor to create
Returns : | a new `gtk.gdk.Cursor`

Creates the new `gtk.gdk.Cursor` from a builtin cursor specified by `cursor_type`. To make the cursor invisible, see the description of the gtk.gdk.Cursor() constructor that creates a cursor from a pixmap below.

        gtk.gdk.Cursor(display, cursor_type)

`display` : | the `gtk.gdk.Display` to create the cursor for
`cursor_type` : | the standard cursor to create
Returns : | a new `gtk.gdk.Cursor`

### Note

This constructor is available in PyGTK 2.4 and above.

Creates the new `gtk.gdk.Cursor` for the `gtk.gdk.Display` specified by `display` from a builtin cursor specified by `cursor_type`. To make the cursor invisible, see the description of the gtk.gdk.Cursor() constructor that creates a cursor from a pixmap below.

        gtk.gdk.Cursor(display, pixbuf, x, y)

`display` : | the `gtk.gdk.Display` to create the cursor for
`pixbuf` : | the `gtk.gdk.Pixbuf` holding the cursor image
`x` : | the "hot spot" x offset
`y` : | the "hot spot" y offset
Returns : | a new `gtk.gdk.Cursor`

### Note

This constructor is available in PyGTK 2.4 and above.

Creates a new `gtk.gdk.Cursor` for the `gtk.gdk.Display` specified by display using the `gtk.gdk.Pixbuf` specified by `source` as the icon image. The "hotspot" of the cursor will be located as the position specified by `x` and `y`. To make the cursor invisible, see the description of the gtk.gdk.Cursor() constructor that creates a cursor from a pixmap below

        gtk.gdk.Cursor(source, mask, fg, bg, x, y)

`source` : | the `gtk.gdk.Pixmap` holding the cursor image
`mask` : | the `gtk.gdk.Pixmap` to use as a mask
`fg` : | the unallocated foreground `gtk.gdk.Color`
`bg` : | the unallocated background `gtk.gdk.Color`
`x` : | the "hot spot" x offset
`y` : | the "hot spot" y offset
Returns : | a new `gtk.gdk.Cursor`

Creates a new `gtk.gdk.Cursor` using:

- the `gtk.gdk.Pixmap` specified by `source` as the icon image
- the `gtk.gdk.Pixmap` specified by `mask` to mask `source` (must be the same size as source)
- the `gtk.gdk.Color` specified by `fg` as the foreground color of the cursor
- the `gtk.gdk.Color` specified by `bg` as the background color of the cursor
- the horizontal offset of the cursor "hot spot" specified by `x`
- the vertical offset of the cursor "hot spot" specified by `y`

To make the cursor invisible, create a cursor from an empty `gtk.gdk.Pixmap` as follows:

      pixmap = gtk.gdk.Pixmap(None, 1, 1, 1)
      color = gtk.gdk.Color()
      cursor = gtk.gdk.Cursor(pixmap, pixmap, color, color, 0, 0)

## Methods

### gtk.gdk.Cursor.get_display

        def get_display()

Returns : | the associated `gtk.gdk.Display`

### Note

This method is available in PyGTK 2.2 and above.

The `get_display`() method returns the `gtk.gdk.Display` on which the cursor is defined.

Prev | Up | Next
gtk.gdk.Colormap | Home | gtk.gdk.Device