Length values in python-docx are expressed as a standardized Length value object. Length is a subclass of int, having all the behavior of an int. In addition, it has built-in units conversion properties, e.g.:
>>> inline_shape.height
914400
>>> inline_shape.height.inches
1.0
Length objects are constructed using a selection of convenience constructors, allowing values to be expressed in the units most appropriate to the context.
Base class for length constructor classes Inches, Cm, Mm, Px, and Emu. Behaves as an int count of English Metric Units, 914,400 to the inch, 36,000 to the mm. Provides convenience unit conversion methods in the form of read-only properties. Immutable.
Convenience constructor for length in inches, e.g. width = Inches(0.5).
Convenience constructor for length in centimeters, e.g. height = Cm(12).
Convenience constructor for length in millimeters, e.g. width = Mm(240.5).
Immutable value object defining a particular RGB color.
r, g, and b are each an integer in the range 0-255 inclusive. Using the hexidecimal integer notation, e.g. 0x42 may enhance readability where hex RGB values are in use:
>>> lavender = RGBColor(0xff, 0x99, 0xcc)
Enter search terms or a module, class or function name.