Display information retrieval methods:
Returns the name used to connect to the server, either provided when
creating the Display
object, or fetched from the environmental
variable $DISPLAY
.
Returns the file descriptor number of the underlying socket. This
method is provided to allow Display
objects to be passed
select.select()
.
Close the display, freeing the resources that it holds.
Set the default error handler which will be called for all unhandled errors. handler should take two arguments as a normal request error handler, but the second argument (the request) will be None.
See section Error Handling.
Flush the request queue, building and sending the queued requests. This can be necessary in applications that never wait for events, and in threaded applications.
Flush the queue and wait until the server has processed all the queued requests. Use this e.g. when it is important that errors caused by a certain request is trapped.
Return the next event. If there are no events queued, it will block until the next event is fetched from the server.
Return the number of events queued, i.e. the number of times that
Display.next_event()
can be called without blocking.
Check if both the server and the client library support the X extension named extension.
Create a resource object of type for the integer id. type should be one of the following strings:
resource
drawable
window
pixmap
fontable
font
gc
colormap
cursor
This function can be used when a resource ID has been fetched e.g. from an resource or a command line argument. Resource objects should never be created by instantiating the appropriate class directly, since any X extensions dynamically added by the library will not be available.
Return the information about screen number sno, or the default
screen if sno is None
.
The reply object has the following attributes:
root
default_colormap
white_pixel
black_pixel
current_input_mask
width_in_pixels
height_in_pixels
width_in_mms
height_in_mms
min_installed_maps
max_installed_maps
root_visual
backing_store
X.WhenMapped
, X.NotUseful
, or X.Always
.
save_unders
root_depth
allowed_depths
depth
visuals
visual_id
visual_class
X.StaticGrey
, X.StaticColor
, X.TrueColor
,
X.GrayScale
, X.PseudoColor
, or X.DirectColor
.
bits_per_rgb_value
2^bits_per_rgb_value
distinct colors.
colormap_entries
red_mask
blue_mask
green_mask
Return the total number of screens on the display.
Return the number of the default screen, extracted from the display name.
Convert a keycode to a keysym, looking in entry index.
Normally index 0 is unshifted, 1 is shifted, 2 is alt grid, and 3 is
shift+alt grid. If that key entry is not bound, X.NoSymbol
is
returned.
Look up the primary keycode that is bound to keysym. If several keycodes are found, the one with the lowest index and lowest code is returned. If keysym is not bound to any key, 0 is returned.
Look up all the keycodes that is bound to keysym
. A list of
tuples (keycode, index)
is returned, sorted primarily on the
lowest index and secondarily on the lowest keycode.
This method should be called once when a MappingNotify
event is
received, to update the keymap cache. evt should be the event
object.
Attempt to convert keysym into a single character or a string. If
no translation is found, None
is returned.
Set the string representation of keysym
to newstring
, so
that it will be returned by Display.lookup_string()
.
X requests methods:
Intern the string name, returning its atom number. If
only_if_exists is true and the atom does not already exist,
it will not be created and X.NONE
is returned.
Look up the name of atom, returning it as a string. Will raise
BadAtom
if atom does not exist.
Return the window that owns selection (an atom), or X.NONE
if there is no owner for the selection. Can raise BadAtom
.
Send a synthetic event to the window destination
which can be a
window object, or X.PointerWindow
or X.InputFocus
.
event
is the event object to send, instantiated from one of the
classes in protocol.events
. See XSendEvent(3X11) for details.
There is also a Window.send_event()
method.
Release a grabbed pointer and any queued events. See XUngrabPointer(3X11).
Change the dynamic parameters of a pointer grab. See XChangeActivePointerGrab(3X11).
Ungrab a grabbed keyboard and any queued events. See XUngrabKeyboard(3X11).
Release some queued events. mode should be one of
X.AsyncPointer
, X.SyncPointer
, X.AsyncKeyboard
,
X.SyncKeyboard
, X.ReplayPointer
, X.ReplayKeyboard
,
X.AsyncBoth
, or X.SyncBoth
. time should be a
timestamp or X.CurrentTime
.
Disable processing of requests on all other client connections until the server is ungrabbed. Server grabbing should be avoided as much as possible.
Release the server if it was previously grabbed by this client.
Move the pointer relative its current position by the offsets (x, y). However, if src_window is a window the pointer is only moved if the specified rectangle in src_window contains it. If src_width is 0 it will be replaced with the width of src_window - src_x. src_height is treated in a similar way.
To move the pointer to absolute coordinates, use
Window.warp_pointer()
.
Set input focus to focus, which should be a window,
X.PointerRoot
or X.NONE
. revert_to specifies where
the focus reverts to if the focused window becomes not visible, and
should be X.RevertToParent
, RevertToPointerRoot
, or
RevertToNone
. See XSetInputFocus(3X11) for details.
There is also a Window.set_input_focus()
.
Return an object with the following attributes:
focus
X.NONE
or
X.PointerRoot
.
revert_to
X.RevertToParent
,
RevertToPointerRoot
, or RevertToNone
.
Return a bit vector for the logical state of the keyboard, where each bit set to 1 indicates that the corresponding key is currently pressed down. The vector is represented as a list of 32 integers. List item N contains the bits for keys 8N to 8N + 7 with the least significant bit in the byte representing key 8N.
Open the font identifed by the pattern name and return its font
object. If name does not match any font, None
is returned.
Return a list of font names matching pattern. No more than max_names will be returned.
Return a list of fonts matching pattern. No more than max_names will be returned. Each list item represents one font and has the following properties:
name
min_bounds
max_bounds
min_char_or_byte2
max_char_or_byte2
default_char
draw_direction
min_byte1
max_byte1
all_chars_exist
font_ascent
font_descent
replies_hint
properties
name
value
Set the font path to path, which should be a list of strings. If path is empty, the default font path of the server will be restored.
Return the current font path as a list of strings.
Ask the server if it supports the extension name. If it is supported an object with the following attributes is returned:
major_opcode
first_event
first_error
If the extension is not supported, None
is returned.
Return a list of all the extensions provided by the server.
Modify the keyboard mapping, starting with first_keycode.
keysyms is a list of tuples of keysyms. keysyms[n][i]
will
be assigned to keycode first_keycode+n
at index i
.
Return the current keyboard mapping as a list of tuples, starting at first_keycount and no more than count.
Change the parameters provided as keyword arguments:
key_click_percent
bell_percent
bell_pitch
bell_duration
led
led_mode
led_mode
should be X.LedModeOff
or X.LedModeOn
. If
led
is provided, it should be a 32-bit mask listing the LEDs that
should change. If led
is not provided, all LEDs are changed.
key
auto_repeat_mode
auto_repeat_mode
should be one of X.AutoRepeatModeOff
,
X.AutoRepeatModeOn
, or X.AutoRepeatModeDefault
. If
key
is provided, that key will be modified, otherwise the global
state for the entire keyboard will be modified.
Return an object with the following attributes:
global_auto_repeat
X.AutoRepeatModeOn
or X.AutoRepeatModeOff
.
auto_repeats
led_mask
key_click_percent
bell_percent
bell_pitch
bell_duration
Ring the bell at the volume percent which is relative the base volume. See XBell(3X11).
To change the pointer acceleration, set accel to a tuple
(num, denum)
. The pointer will then move num/denum
times
the normal speed if it moves beyond the threshold number of pixels at
once. To change the threshold, set it to the number of pixels. -1
restores the default.
Return an object with the following attributes:
accel_num
accel_denom
threshold
See XSetScreenSaver(3X11).
Return an object with the attributes timeout
, interval
,
prefer_blanking
, allow_exposures
. See
XGetScreenSaver(3X11) for details.
mode is either X.HostInsert
or X.HostDelete
.
host_family is one of X.FamilyInternet
,
X.FamilyDECnet
or X.FamilyChaos
.
host is a list of bytes. For the Internet family, it should be the four bytes of an IPv4 address.
Return an object with the following attributes:
mode
X.EnableAccess
if the access control list is used,
X.DisableAccess
otherwise.
hosts
family
X.FamilyInternet
, X.FamilyDECnet
, or X.FamilyChaos
.
name
family
. For the
Internet family, it is the 4 bytes of an IPv4 address.
Enable use of access control lists at connection setup if mode is
X.EnableAccess
, disable if it is X.DisableAccess
.
Control what will happen with the client's resources at connection
close. The default is X.DestroyAll
, the other values are
X.RetainPermanent
and X.RetainTemporary
.
If mode is X.ScreenSaverActive
the screen saver is
activated. If it is X.ScreenSaverReset
, the screen saver is
deactivated as if device input had been received.
Set the mapping of the pointer buttons. map is a list of logical
button numbers. map must be of the same length as the list
returned by Display.get_pointer_mapping()
.
map[n]
sets the logical number for the physical button
n+1
. Logical number 0 disables the button. Two physical buttons
cannot be mapped to the same logical number.
If one of the buttons to be altered are logically in the down state,
X.MappingBusy
is returned and the mapping is not changed.
Otherwise the mapping is changed and X.MappingSuccess
is returned.
Return a list of the pointer button mappings. Entry N in the list sets the logical button number for the physical button N+1.
Set the keycodes for the eight modifiers X.Shift
, X.Lock
,
X.Control
, X.Mod1
, X.Mod2
, X.Mod3
,
X.Mod4
and X.Mod5
. keycodes should be a
eight-element list where each entry is a list of the keycodes that
should be bound to that modifier.
If any changed key is logically in the down state, X.MappingBusy
is returned and the mapping is not changed. If the mapping violates
some server restriction, X.MappingFailed
is returned. Otherwise
the mapping is changed and X.MappingSuccess
is returned.
Return a list of eight lists, one for each modifier. The list can be
indexed using X.ShiftMapIndex
, X.Mod1MapIndex
, and so on.
The sublists list the keycodes bound to that modifier.
Do nothing but send a request to the server.
Go to the first, previous, next, last section, table of contents.