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
- Xlib - C Language X Interface
- python3-xlib (https://pypi.org/project/python3-xlib/)
AUTHOR
Hiroyuki Ohsaki <ohsaki[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
Built Distribution
File details
Details for the file x11util-1.3.tar.gz
.
File metadata
- Download URL: x11util-1.3.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e93bbe8f848bd108cc943a1735322fd6640eec6a5afe84cad6c1dc5e8cb8571 |
|
MD5 | 76c82a2c8cbaab8cd4be023e9e421e7b |
|
BLAKE2b-256 | ff966333c5db4457fd4d65b44fd70561e7246f6344b6c4d30189eab33a39246b |
File details
Details for the file x11util-1.3-py3-none-any.whl
.
File metadata
- Download URL: x11util-1.3-py3-none-any.whl
- Upload date:
- Size: 17.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 937577049b6b214fb8b05953792a8673ac7d387be55c1d43304a5aaf17c55dca |
|
MD5 | 51c96414d63df5459b63f1a546046c47 |
|
BLAKE2b-256 | 14f521b71e98f194873e45bddba6c7e08faa59ccacdc98d8615a12d218418dd2 |