Skip to main content

Wrapper fucntions to make X11 low-level Xlib programming easier

Project description

x11util Package

x11util - Wrapper fucntions to make X11 low-level Xlib programming easier

DESCRIPTION

This manual page documents x11util module, a Python module providing several wrapper function for Xlib programming easier.

EXAMPLE

import time
from Xlib import X, display
from x11util import create_window, create_gcs, load_font, draw_str, flush

disp = display.Display()
font = load_font(disp)
screen = disp.screen()
window = create_window(disp, screen, width=320, height=240, x=100, y=200)
gcs = create_gcs(disp, screen, window, font)
draw_str(disp, screen, window, gcs, 'Hello, World!', 10, 20)
draw_str(disp, screen, window, gcs, 'Hello, World!', 11, 21, level=50)
flush(disp, screen)
time.sleep(10)

FUNCTIONS

x11util module provides the following functions.

  • create_window(disp, screen, width=640, height=480, x=0, y=0, override=1, mask=X.ExposureMask)

    Create a new window on screen SCREEN in display DISP with given WIDTH and HEIGHT, which is placed at the geometry of (X, Y) using Xlib's XCreateWindow. override_redirect and event_mask can specified by OVERRIDE and MASK, respectively.

  • load_font(disp, font=None)

    Load bitmap font FONT in display DISP, and return the loaded font object. If font loading failed, return None.

  • create_gcs(disp, screen, window, font)

    Create GCs (Graphics Content) on screen SCREEN in display DISP for window WINDOW with font FONT. GCs are returned as a dictionary, whose key is the color name (e.g., 'SteelBlue') and the value is a dictionary, whose items are (LEVEL, GC), where LEVEL is a brightness between 0 and 100 and GC is the GC for that brightness.

  • clear(window)

    Erase the window WINDOW.

  • draw_str(disp, screen, window, gcs, astr, col=0, row=0, color='PaleGreen', level=100, reverse=False)

    Render a string ASTR on window WINDOW on screen SCREEN in display DISP using graphics contents GC. Text color and brightness can be specified by COLOR and LEVEL, respectively. Reverse video is enabled if REVERSE is True.

  • flush(disp, screen)

    Flush all pending X11 requests.

CUSTOMIZATION

On startup, x11util module loads per-user RC script (~/.x11utilrc) if it exists. The RC script is any valid Python script. You can change the behavior of x11util using the RC file.

An example ~/.x11utilrc file is as follows.

global FONT_NAME
FONT_NAME = '-hiro-fixed-medium-r-normal--8-80-75-75-c-80-iso646.1991-irv'

INSTALLATION

pip3 install x11util

AVAILABILITY

The latest version of x11util module is available at PyPI (https://pypi.org/project/x11util/) .

SEE ALSO

AUTHOR

Hiroyuki Ohsaki <code[atmark]lsnl.jp>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

x11util-1.4.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

x11util-1.4-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file x11util-1.4.tar.gz.

File metadata

  • Download URL: x11util-1.4.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for x11util-1.4.tar.gz
Algorithm Hash digest
SHA256 2f0302f30f776dfc9409bb01149661ffc4893300be7fad8307d05a5b50eb257c
MD5 5317bf5b2ff42dbf2fc97bedd07049ce
BLAKE2b-256 5d8d2b266f055451daf3071d271facc0f48c3e6b9d5b87446d830dd5ffc41ad4

See more details on using hashes here.

File details

Details for the file x11util-1.4-py3-none-any.whl.

File metadata

  • Download URL: x11util-1.4-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for x11util-1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fd2f27f77801a212afbb1dbe66a46cbb7f18f2da31696771f9cccc7e9d7fe9dc
MD5 95a91099b0f6f43f7ce8cec35925a6c6
BLAKE2b-256 863079b0b3a90dcf125ea4a3276a5b302cb4aa231f312fe4b2f28486d1c090a9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page