ged2doc.dumbemf

Python module for generating EMF.

Only the most trivial features are implemented, stuff that is required by ged2doc package.

Classes

BackgroundMode()

EMF(width, height)

Class for EMF, top-level structure.

GeneralRecord(type, *pack_args)

Base class for all EMF records.

MapMode()

PenStyle()

Record()

Base class for all EMF records.

StockObjects()

class ged2doc.dumbemf.EMF(width, height)[source]

Bases: object

Class for EMF, top-level structure.

Parameters
width, heightged2doc.size.Size

Document width and height, accepts anything convertible to ged2doc.size.Size.

Methods

data()

Produce complete EMF structure.

polyline(points)

Draw polyline.

rectangle(left, top, right, bottom)

Draw rectangle.

set_bkmode(mode)

Set background mode.

text(x, y, text)

Draw text.

text_align([align_mode])

Set text alignment for next text drawing operation

text_color(color)

Set text color for next text drawing operation

use_font(size[, fontname])

Context manager which sets font parameters.

use_pen(style, width, color)

Context manager which sets pen parameters.

data()[source]

Produce complete EMF structure.

Returns
databytes

Byte-string with EMF data.

use_pen(style, width, color)[source]

Context manager which sets pen parameters.

Parameters
stylestr

Pen style.

widthged2doc.size.Size

Pen width.

colorint

Pen color.

use_font(size, fontname='Times New Roman')[source]

Context manager which sets font parameters.

Parameters
sizeged2doc.size.Size

Font size.

fontnamestr

Font family name.

set_bkmode(mode)[source]

Set background mode.

Parameters
modeint

Mode, one of BackgroundMode constants.

polyline(points)[source]

Draw polyline.

Parameters
pointslist [ tuple ]

List of 2-tuples with (x, y) coordinates, each coordinate is ged2doc.size.Size.

rectangle(left, top, right, bottom)[source]

Draw rectangle.

Parameters
left, top, right, bottomged2doc.size.Size

Rectangle coordinates.

text_align(align_mode='c')[source]

Set text alignment for next text drawing operation

Parameters
align_modestr, optional

One of “l”, “c”, “r”.

text_color(color)[source]

Set text color for next text drawing operation

Parameters
colorint
text(x, y, text)[source]

Draw text.

Parameters
x, yged2doc.size.Size

Text coordinates.

textstr

Text to draw.

class ged2doc.dumbemf.BackgroundMode[source]

Bases: object

TRANSPARENT = 1
OPAQUE = 0