1. Querying supported Labels and Printers#
This page covers accessing data about supported labels and printers.
1.1. Base Class#
The API is designed around ElementsManager - a class that wraps a static list of objects which each contain data about one element.
- class brother_ql.helpers.ElementsManager#
A class managing a collection of ‘elements’. Those elements are expected to be objects that * can be compared for equality against each other * have the attribute .identifier
- element_name = 'element'#
what an element is
- elements = []#
list of elements contained by this manager
- get(identifier: str, default=None)#
Returns the element object with the given identifier, or if it doesn’t exist, the default value
- Parameters:
identifier – the identifier to look for
default – what to return if the given identifier is not found
- identifiers()#
Returns a list of the identifiers of all the elements in this manager
- iter_elements()#
Returns an iterator over all the element objects in this manager
- iter_identifiers()#
Returns an iterator over the identifiers of all the elements in this manager
1.2. Printer Models#
- class brother_ql.models.Model(identifier: str, min_max_length_dots: Tuple[int, int], min_max_feed: Tuple[int, int] = (35, 1500), number_bytes_per_row: int = 90, additional_offset_r: int = 0, mode_setting: bool = True, cutting: bool = True, expanded_mode: bool = True, compression: bool = True, two_color: bool = False, num_invalidate_bytes: int = 200)#
This class represents a printer model. All specifics of a certain model and the opcodes it supports should be contained in this class.
- compression: bool#
Model has support for compressing the transmitted raster data. Some models with only USB connectivity don’t support compression.
- expanded_mode: bool#
Model has support for the ‘expanded mode’ opcode. (So far, all models that have cutting support do).
1.3. Label Types#
- class brother_ql.labels.Color(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Enumeration representing the colors to be printed on a label. Most labels only support printing black on white. Some newer ones can also print in black and red on white.
- BLACK_RED_WHITE = 1#
The label can be printed in black, white & red.
- BLACK_WHITE = 0#
The label can be printed in black & white.
- class brother_ql.labels.FormFactor(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Enumeration representing the form factor of a label. The labels for the Brother QL series are supplied either as die-cut (pre-sized), or for more flexibility the continuous label tapes offer the ability to vary the label length.
- DIE_CUT = 1#
rectangular die-cut labels
- ENDLESS = 2#
endless (continuous) labels
- ROUND_DIE_CUT = 3#
round die-cut labels
- class brother_ql.labels.Label(identifier: str, tape_size: Tuple[int, int], form_factor: FormFactor, dots_total: Tuple[int, int], dots_printable: Tuple[int, int], offset_r: int, feed_margin: int = 0, restricted_to_models: List[str] = NOTHING, color: Color = Color.BLACK_WHITE)#
This class represents a label. All specifics of a certain label and what the rasterizer needs to take care of depending on the label choosen, should be contained in this class.
- feed_margin: int#
An additional amount of feeding when printing the label. This is non-zero for some smaller label sizes and for endless labels.
- form_factor: FormFactor#
The type of label
- offset_r: int#
The required offset from the right side of the label in dots to obtain a centered printout.
- restricted_to_models: List[str]#
If a label can only be printed with certain label printers, this member variable lists the allowed ones. Otherwise it’s an empty list.