Cursor
Superclasses: Object
- Constructors:
Cursor(**properties)
new_from_name(name:str, fallback:Gdk.Cursor=None) -> Gdk.Cursor or None
new_from_texture(texture:Gdk.Texture, hotspot_x:int, hotspot_y:int, fallback:Gdk.Cursor=None) -> Gdk.Cursor
Constructors
- class Cursor
- classmethod new_from_name(name: str, fallback: Cursor | None = None) Cursor | None
Creates a new cursor by looking up
name
in the current cursor theme.A recommended set of cursor names that will work across different platforms can be found in the CSS specification:
“none”
“default”
“help”
“pointer”
“context-menu”
“progress”
“wait”
“cell”
“crosshair”
“text”
“vertical-text”
“alias”
“copy”
“no-drop”
“move”
“not-allowed”
“grab”
“grabbing”
“all-scroll”
“col-resize”
“row-resize”
“n-resize”
“e-resize”
“s-resize”
“w-resize”
“ne-resize”
“nw-resize”
“sw-resize”
“se-resize”
“ew-resize”
“ns-resize”
“nesw-resize”
“nwse-resize”
“zoom-in”
“zoom-out”
- Parameters:
name – the name of the cursor
fallback –
None
or theGdkCursor
to fall back to when this one cannot be supported
- classmethod new_from_texture(texture: Texture, hotspot_x: int, hotspot_y: int, fallback: Cursor | None = None) Cursor
Creates a new cursor from a
GdkTexture
.- Parameters:
texture – the texture providing the pixel data
hotspot_x – the horizontal offset of the “hotspot” of the cursor
hotspot_y – the vertical offset of the “hotspot” of the cursor
fallback – the
GdkCursor
to fall back to when this one cannot be supported
Methods
- class Cursor
- get_fallback() Cursor | None
Returns the fallback for this
cursor
.The fallback will be used if this cursor is not available on a given
GdkDisplay
. For named cursors, this can happen when using nonstandard names or when using an incomplete cursor theme. For textured cursors, this can happen when the texture is too large or when theGdkDisplay
it is used on does not support textured cursors.
- get_hotspot_x() int
Returns the horizontal offset of the hotspot.
The hotspot indicates the pixel that will be directly above the cursor.
Note that named cursors may have a nonzero hotspot, but this function will only return the hotspot position for cursors created with
new_from_texture
.
- get_hotspot_y() int
Returns the vertical offset of the hotspot.
The hotspot indicates the pixel that will be directly above the cursor.
Note that named cursors may have a nonzero hotspot, but this function will only return the hotspot position for cursors created with
new_from_texture
.