X Objects
*********

All X operations are performed by invoking object methods.

The objects and their methods are listed in the following nodes, however with no detailed explanations.  The reader are referred to other sources of X documentation for details, e.g. the X protocol specification, the C Xlib documentation or man pages.  A vast collection of X documentation links can be found at http://www.rahul.net/kenton/xsites.html.

Methods returning a single value will return that directly.  Otherwise, an object containing attributes for each of the result values is returned.

Methods returning some value will raise an exception on error.  Methods which does not return any value have instead an on_error parameter, which can be used to specify an error handler.

Display
=======

Display information retrieval methods:

 -- Method on Display: get_display_name ( )

 -- Method on Display: fileno ( )

 -- Method on Display: close ( )

 -- Method on Display: set_error_handler ( handler )

 -- Method on Display: flush ( )

 -- Method on Display: sync ( )

 -- Method on Display: next_event ( )

 -- Method on Display: pending_events ( )

 -- Method on Display: has_extension ( extension )

 -- Method on Display: create_resource_object ( type, id )

 -- Method on Display: screen ( sno = None )

 -- Method on Display: screen_count ( )

 -- Method on Display: get_default_screen ( )

 -- Method on Display: keycode_to_keysym ( keycode, index )

 -- Method on Display: keysym_to_keycode ( keysym )

 -- Method on Display: keysym_to_keycodes ( keysym )

 -- Method on Display: refresh_keyboard_mapping ( evt )

 -- Method on Display: lookup_string ( keysym )

 -- Method on Display: rebind_string ( keysym, newstring )

X requests methods:

 -- Method on Display: intern_atom ( name, only_if_exists = 0 )
     Returns Card32(atom)

 -- Method on Display: get_atom_name ( atom )
     Returns String(name)

 -- Method on Display: get_selection_owner ( selection )
     Returns Window(owner, (X.NONE, ))

 -- Method on Display: send_event ( destination, event, event_mask = 0, propagate = 0, onerror = None )

 -- Method on Display: ungrab_pointer ( time, onerror = None )

 -- Method on Display: change_active_pointer_grab ( event_mask, cursor, time, onerror = None )

 -- Method on Display: ungrab_keyboard ( time, onerror = None )

 -- Method on Display: allow_events ( mode, time, onerror = None )

 -- Method on Display: grab_server ( onerror = None )

 -- Method on Display: ungrab_server ( onerror = None )

 -- Method on Display: warp_pointer ( x, y, src_window = 0, src_x = 0, src_y = 0, src_width = 0, src_height = 0, onerror = None )

 -- Method on Display: set_input_focus ( focus, revert_to, time, onerror = None )

 -- Method on Display: get_input_focus ( )
     Returns Card8('revert_to'), Window('focus', (X.NONE, X.PointerRoot))

 -- Method on Display: query_keymap ( )
     Returns FixedList('map', 32, Card8Obj)

 -- Method on Display: open_font ( name )
     Returns Font or None.

 -- Method on Display: list_fonts ( pattern, max_names )
     Returns List('fonts', Str)

 -- Method on Display: list_fonts_with_info ( pattern, max_names )
     Returns a list of Object('min_bounds', structs.CharInfo), Object('max_bounds', structs.CharInfo), Card16('min_char_or_byte2'), Card16('max_char_or_byte2'), Card16('default_char'), Card8('draw_direction'), Card8('min_byte1'), Card8('max_byte1'), Card8('all_chars_exist'), Int16('font_ascent'), Int16('font_descent'), Card32('replies_hint'), List('properties', structs.FontProp), String8('name'),

 -- Method on Display: set_font_path ( path, onerror = None )

 -- Method on Display: get_font_path ( )
     Returns List('paths', Str)

 -- Method on Display: query_extension ( name )
     Returns None, or  Card8('major_opcode'), Card8('first_event'), Card8('first_error'),

 -- Method on Display: list_extensions ( )
     Returns List('names', Str)

 -- Method on Display: change_keyboard_mapping ( first_keycode, keysyms, onerror = None )

 -- Method on Display: get_keyboard_mapping ( first_keycode, count )
     Returns KeyboardMapping('keysyms'),

 -- Method on Display: change_keyboard_control ( onerror = None, **keys )

 -- Method on Display: get_keyboard_control ( )

 -- Method on Display: bell ( percent = 0, onerror = None )

 -- Method on Display: change_pointer_control ( accel = None, threshold = None, onerror = None )
     ACCEL should be None or (num, denum).

 -- Method on Display: get_pointer_control ( )
     Returns Card16('accel_num'), Card16('accel_denom'), Card16('threshold'),

 -- Method on Display: set_screen_saver ( timeout, interval, prefer_blank, allow_exposures, onerror = None )

 -- Method on Display: get_screen_saver ( )
     Returns Card16('timeout'), Card16('interval'), Card8('prefer_blanking'), Card8('allow_exposures'),

 -- Method on Display: change_hosts ( mode, host_family, host, onerror = None )

 -- Method on Display: list_hosts ( )
     Returns Card8('mode'), List('hosts', structs.Host),

 -- Method on Display: set_access_control ( mode, onerror = None )

 -- Method on Display: set_close_down_mode ( mode, onerror = None )

 -- Method on Display: force_screen_saver ( mode, onerror = None )

 -- Method on Display: set_pointer_mapping ( map )
     Returns Card8('status'),

 -- Method on Display: get_pointer_mapping ( )
     Returns List('map', Card8Obj),

 -- Method on Display: set_modifier_mapping ( keycodes )
     Returns Card8('status'),

 -- Method on Display: get_modifier_mapping ( )
     Returns ModifierMapping('keycodes')

 -- Method on Display: no_operation ( onerror = None )

Resource
========

All resource objects can be compared and hashed, so they can be used as mapping indices.  They also have this method:

 -- Method on Resource: kill_client ( onerror = None )

Colormap
========

See Resource, for additional methods on Colormap objects.

 -- Method on Colormap: free ( onerror = None )

 -- Method on Colormap: copy_colormap_and_free ( scr_cmap )
     Returns Colormap.

 -- Method on Colormap: install_colormap ( onerror = None )

 -- Method on Colormap: uninstall_colormap ( onerror = None )

 -- Method on Colormap: alloc_color ( red, green, blue )

 -- Method on Colormap: alloc_named_color ( name )
     Returns None or  Card32('pixel'), Card16('exact_red'), Card16('exact_green'), Card16('exact_blue'), Card16('screen_red'), Card16('screen_green'), Card16('screen_blue'),

 -- Method on Colormap: alloc_color_cells ( contiguous, colors, planes )
     Returns  List('pixels', Card32Obj), List('masks', Card32Obj),

 -- Method on Colormap: alloc_color_planes ( contiguous, colors, red, green, blue )
     Returns  Card32('red_mask'), Card32('green_mask'), Card32('blue_mask'), List('pixels', Card32Obj),

 -- Method on Colormap: free_colors ( pixels, plane_mask, onerror = None )

 -- Method on Colormap: store_colors ( items, onerror = None )

 -- Method on Colormap: store_named_color ( name, pixel, flags, onerror = None )

 -- Method on Colormap: query_colors ( pixels )
     Returns List('colors', structs.RGB),

 -- Method on Colormap: lookup_color ( name )
     Returns  Card16('exact_red'), Card16('exact_green'), Card16('exact_blue'), Card16('screen_red'), Card16('screen_green'), Card16('screen_blue'),

Cursor
======

See Resource, for additional methods on Cursor objects.

 -- Method on Cursor: free ( onerror = None )

 -- Method on Cursor: recolor ( (fore_red, fore_green, fore_blue), (back_red, back_green, back_blue), onerror = None )

Drawable
========

Drawable is a base class of Window and Pixmap objects.  See Window, and Pixmap.

See Resource, for additional methods.

 -- Method on Drawable: get_geometry ( )
     Returns Window('root'), Int16('x'), Int16('y'), Card16('width'), Card16('height'), Card16('border_width'),

 -- Method on Drawable: create_pixmap ( width, height, depth )
     Returns Pixmap.

 -- Method on Drawable: create_gc ( **keys )
     Returns GC.

 -- Method on Drawable: copy_area ( gc, src_drawable, src_x, src_y, width, height, dst_x, dst_y, onerror = None )

 -- Method on Drawable: copy_plane ( gc, src_drawable, src_x, src_y, width, height, dst_x, dst_y, bit_plane, onerror = None )

 -- Method on Drawable: poly_point ( gc, coord_mode, points, onerror = None )

request.PolyPoint(display = self.display, onerror = onerror, coord_mode = coord_mode, drawable = self.id, gc = gc, points = points)

 -- Method on Drawable: point ( gc, x, y, onerror = None )

 -- Method on Drawable: poly_line ( gc, coord_mode, points, onerror = None )

 -- Method on Drawable: line ( gc, x1, y1, x2, y2, onerror = None )

 -- Method on Drawable: poly_segment ( gc, segments, onerror = None )

 -- Method on Drawable: poly_rectangle ( gc, rectangles, onerror = None )

 -- Method on Drawable: rectangle ( gc, x, y, width, height, onerror = None )

 -- Method on Drawable: poly_arc ( gc, arcs, onerror = None )

 -- Method on Drawable: arc ( gc, x, y, width, height, angle1, angle2, onerror = None )

 -- Method on Drawable: fill_poly ( gc, shape, coord_mode, points, onerror = None )

 -- Method on Drawable: poly_fill_rectangle ( gc, rectangles, onerror = None )

 -- Method on Drawable: fill_rectangle ( gc, x, y, width, height, onerror = None )

 -- Method on Drawable: poly_fill_arc ( gc, arcs, onerror = None )

 -- Method on Drawable: fill_arc ( gc, x, y, width, height, angle1, angle2, onerror = None )

 -- Method on Drawable: put_image ( )
     Not implemented yet.

 -- Method on Drawable: get_image ( )
     Not implemented yet.

 -- Method on Drawable: draw_text ( gc, x, y, text, onerror = None )

 -- Method on Drawable: poly_text ( gc, x, y, items, onerror = None )

 -- Method on Drawable: poly_text_16 ( gc, x, y, items, onerror = None )

 -- Method on Drawable: image_text ( gc, x, y, string, onerror = None )

 -- Method on Drawable: image_text_16 ( gc, x, y, string, onerror = None )

 -- Method on Drawable: query_best_size ( item_class, width, height )
     Returns Card16('width'), Card16('height'),

Window
======

Window objects have additional objects, see Resource and Drawable.

 -- Method on Window: create_window ( x, y, width, height, border_width, depth, window_class = X.CopyFromParent, visual = X.CopyFromParent, **keys )
     Returns Window

 -- Method on Window: change_attributes ( onerror = None, **keys )

 -- Method on Window: get_attributes ( )
     Returns Card8('backing_store'), Card32('visual'), Card16('class'), Card8('bit_gravity'), Card8('win_gravity'), Card32('backing_bit_planes'), Card32('backing_pixel'), Card8('save_under'), Card8('map_is_installed'), Card8('map_state'), Card8('override_redirect'), Colormap('colormap', (X.NONE, )), Card32('all_event_masks'), Card32('your_event_mask'), Card16('do_not_propagate_mask'),

 -- Method on Window: destroy ( onerror = None )

 -- Method on Window: destroy_sub_windows ( onerror = None )

 -- Method on Window: change_save_set ( mode, onerror = None )

 -- Method on Window: reparent ( parent, x, y, onerror = None )

 -- Method on Window: map ( onerror = None )

 -- Method on Window: map_sub_windows ( onerror = None )

 -- Method on Window: unmap ( onerror = None )

 -- Method on Window: unmap_sub_windows ( onerror = None )

 -- Method on Window: configure ( onerror = None, **keys )

 -- Method on Window: circulate ( direction, onerror = None )

 -- Method on Window: query_tree ( )
     Returns Window('root'), Window('parent', (X.NONE, )), List('children', WindowObj),

 -- Method on Window: change_property ( property, type, format, data, mode = X.PropModeReplace, onerror = None )

 -- Method on Window: delete_property ( property, onerror = None )

 -- Method on Window: get_property ( property, type, offset, length, delete = 0 )
     Returns None or Card32('property_type'), Card8('format'), PropertyData('value'), Card32('bytes_after'),

 -- Method on Window: get_full_property ( property, type, sizehint = 10 )
     Returns None or Card32('property_type'), Card8('format'), PropertyData('value'), Card32('bytes_after'),

 -- Method on Window: list_properties ( )
     Returns List('atoms', Card32Obj),

 -- Method on Window: set_selection_owner ( selection, time, onerror = None )

 -- Method on Window: convert_selection ( selection, target, property, time, onerror = None )

 -- Method on Window: send_event ( event, event_mask = 0, propagate = 0, onerror = None )

 -- Method on Window: grab_pointer ( owner_events, event_mask, pointer_mode, keyboard_mode, confine_to, cursor, time )
     Returns Card8('status'),

 -- Method on Window: grab_button ( button, modifiers, owner_events, event_mask, pointer_mode, keyboard_mode, confine_to, cursor, onerror = None )

 -- Method on Window: ungrab_button ( button, modifiers, onerror = None )

 -- Method on Window: grab_keyboard ( owner_events, pointer_mode, keyboard_mode, time )
     Returns Card8('status'),

 -- Method on Window: grab_key ( key, modifiers, owner_events, pointer_mode, keyboard_mode, onerror = None )

 -- Method on Window: ungrab_key ( key, modifiers, onerror = None )

 -- Method on Window: query_pointer ( )
     Returns Card8('same_screen'), Window('root'), Window('child', (X.NONE, )), Int16('root_x'), Int16('root_y'), Int16('win_x'), Int16('win_y'), Card16('mask'),

 -- Method on Window: get_motion_events ( start, stop )
     Returns List('events', structs.TimeCoord),

 -- Method on Window: translate_coords ( src_window, src_x, src_y )
     Returns Window('child', (X.NONE, )), Int16('x'), Int16('y'),

 -- Method on Window: warp_pointer ( x, y, src_window = 0, src_x = 0, src_y = 0, src_width = 0, src_height = 0, onerror = None )

 -- Method on Window: set_input_focus ( revert_to, time, onerror = None )

 -- Method on Window: clear_area ( x = 0, y = 0, width = 0, height = 0, exposures = 0, onerror = None )

 -- Method on Window: create_colormap ( visual, alloc )
     Returns Colormap.

 -- Method on Window: list_installed_colormaps ( )
     Returns List('cmaps', ColormapObj),

 -- Method on Window: rotate_properties ( properties, delta, onerror = None )

 -- Method on Window: set_wm_name ( name, onerror = None )

 -- Method on Window: get_wm_name ( )
     Returns None or string.

 -- Method on Window: set_wm_icon_name ( name, onerror = None )

 -- Method on Window: get_wm_icon_name ( )
     Returns None or string.

 -- Method on Window: set_wm_class ( inst, cls, onerror = None )

 -- Method on Window: get_wm_class ( )
     Returns None or (isntance, class)

 -- Method on Window: set_wm_transient_for ( window, onerror = None )

 -- Method on Window: get_wm_transient_for ( )
     Returns None or Window.

 -- Method on Window: set_wm_protocols ( protocols, onerror = None )

 -- Method on Window: get_wm_protocols ( )
     Returns list of atoms.

 -- Method on Window: set_wm_colormap_windows ( windows, onerror = None )

 -- Method on Window: get_wm_colormap_windows ( )
     Returns list of Windows.

 -- Method on Window: set_wm_client_machine ( name, onerror = None )

 -- Method on Window: get_wm_client_machine ( )
     Returns None or string.

 -- Method on Window: set_wm_normal_hints ( hints = , onerror = None, **keys )

 -- Method on Window: get_wm_normal_hints ( )
     Returns  Card32('flags'), Int32('min_width', default = 0), Int32('min_height', default = 0), Int32('max_width', default = 0), Int32('max_height', default = 0), Int32('width_inc', default = 0), Int32('height_inc', default = 0), Object('min_aspect', Aspect, default = (0, 0)), Object('max_aspect', Aspect, default = (0, 0)), Int32('base_width', default = 0), Int32('base_height', default = 0), Int32('win_gravity', default = 0),

 -- Method on Window: set_wm_hints ( hints = , onerror = None, **keys )

 -- Method on Window: get_wm_hints ( )
     Returns Card32('flags'), Card32('input', default = 0), Set('initial_state', 4, ( Xutil.NormalState, Xutil.IconicState ), default = Xutil.NormalState), Pixmap('icon_pixmap', default = 0), Window('icon_window', default = 0), Int32('icon_x', default = 0), Int32('icon_y', default = 0), Pixmap('icon_mask', default = 0), Window('window_group', default = 0),

 -- Method on Window: set_wm_state ( hints = , onerror = None, **keys )

 -- Method on Window: get_wm_state ( )
     Returns  Set('state', 4, ( Xutil.WithdrawnState, Xutil.NormalState, Xutil.IconicState )), Window('icon', ( X.NONE, )),

 -- Method on Window: set_wm_icon_size ( hints = , onerror = None, **keys )

 -- Method on Window: get_wm_icon_size ( )
     Returns Card32('min_width'), Card32('min_height'), Card32('max_width'), Card32('max_height'), Card32('width_inc'), Card32('height_inc'),

Pixmap
======

Pixmap objects have additional objects, see Resource and Drawable.

 -- Method on Pixmap: free ( onerror = None )

 -- Method on Pixmap: create_cursor ( mask, (fore_red, fore_green, fore_blue), (back_red, back_green, back_blue), x, y )
     Returns Cursor.

Fontable
========

Fontable is a base class of GC and Font objects.  See GC, and Font.

See Resource, for additional methods.

 -- Method on Fontable: query ( )
     Returns Object('min_bounds', structs.CharInfo), Object('max_bounds', structs.CharInfo), Card16('min_char_or_byte2'), Card16('max_char_or_byte2'), Card16('default_char'), Card8('draw_direction'), Card8('min_byte1,'), Card8('max_byte1,'), Card8('all_chars_exist'), Int16('font_ascent'), Int16('font_descent'), List('properties', structs.FontProp), List('char_infos', structs.CharInfo),

 -- Method on Fontable: query_text_extents ( string )
     Returns Card8('draw_direction'), Int16('font_ascent'), Int16('font_descent'), Int16('overall_ascent'), Int16('overall_descent'), Int32('overall_width'), Int32('overall_left'), Int32('overall_right'),

GC
==

GC objects have additional objects, see Resource and Fontable.

 -- Method on GC: change ( onerror = None, **keys )

 -- Method on GC: copy ( src_gc, mask, onerror = None )

 -- Method on GC: set_dashes ( offset, dashes, onerror = None )

 -- Method on GC: set_clip_rectangles ( x_origin, y_origin, rectangles, ordering, onerror = None )

 -- Method on GC: free ( onerror = None )

Font
====

Font objects have additional objects, see Resource and Fontable.

 -- Method on Font: close ( onerror = None )

 -- Method on Font: create_glyph_cursor ( mask, source_char, mask_char, (fore_red, fore_green, fore_blue), (back_red, back_green, back_blue) )
     Returns Cursor.