Using the Scanner module

The PyWayland scanner allows you to generate the protocol scanner output within Python scripts. The general procedure to invoke the scanner will be to make a Protocol object, scan the input file, and have the Protocol output to a directory. These steps are done as:

Protocol.output(path_to_output_dir, {})

See the definitions below for more information on using Protocol objects.

Protocol Module

class pywayland.scanner.Protocol(name: str, copyright: Copyright | None, description: Description | None, interface: list[Interface])

Protocol scanner object

Main scanner object that acts on the input xml files to generate protocol files.

Required attributes: name

Child elements: copyright?, description?, and interface+

Parameters:input_file – Name of input XML file
output(output_dir: str, module_imports: dict[str, str]) → None

Output the scanned files to the given directory

Parameters:output_dir (string) – Path of directory to output protocol files to