Utilities Module

AnonymousFile Class

class pywayland.utils.AnonymousFile(size: int)

Anonymous file object

Provides access to anonymous file objects that can be used by Wayland clients to render to surfaces. Uses a method similar to Weston to open an anonymous file, so XDG_RUNTIME_DIR must be set for this to work properly.

This class provides a content manager, that is, it can be used with Python with statements, where the value returned is the file descriptor.

close() → None

Close the anonymous file

Closes the file descriptor and sets the fd property to None. Does nothing if the file is not open.

open() → None

Open an anonymous file

Opens the anonymous file and sets the fd property to the file descriptor that has been opened.