Picture

class Picture(impl=None)

The picture object is a member of the pictures collection:

>>> import xlwings as xw
>>> sht = xw.books['Book1'].sheets[0]
>>> sht.pictures[0]  # or sht.charts['PictureName']
<Picture 'Picture 1' in <Sheet [Book1]Sheet1>>

Changed in version 0.9.0.

property api

Returns the native object (pywin32 or appscript obj) of the engine being used.

Added in version 0.9.0.

delete()

Deletes the picture.

Added in version 0.5.0.

property height

Returns or sets the number of points that represent the height of the picture.

Added in version 0.5.0.

property left

Returns or sets the number of points that represent the horizontal position of the picture.

Added in version 0.5.0.

property lock_aspect_ratio

True will keep the original proportion, False will allow you to change height and width independently of each other (read/write).

Added in version 0.24.0.

property name

Returns or sets the name of the picture.

Added in version 0.5.0.

property parent

Returns the parent of the picture.

Added in version 0.9.0.

property top

Returns or sets the number of points that represent the vertical position of the picture.

Added in version 0.5.0.

update(image, format=None, export_options=None)

Replaces an existing picture with a new one, taking over the attributes of the existing picture.

Arguments

imagestr or path-like object or matplotlib.figure.Figure

Either a filepath or a Matplotlib figure object.

formatstr, default None

See under Pictures.add()

export_optionsdict, default None

See under Pictures.add()

Added in version 0.5.0.

property width

Returns or sets the number of points that represent the width of the picture.

Added in version 0.5.0.