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.

New in version 0.9.0.

delete()#

Deletes the picture.

New in version 0.5.0.

property height#

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

New in version 0.5.0.

property left#

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

New 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).

New in version 0.24.0.

property name#

Returns or sets the name of the picture.

New in version 0.5.0.

property parent#

Returns the parent of the picture.

New in version 0.9.0.

property top#

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

New 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.

Parameters
  • image (str or path-like object or matplotlib.figure.Figure) – Either a filepath or a Matplotlib figure object.

  • format (str, default None) – See under Pictures.add()

  • export_options (dict, default None) – See under Pictures.add()

New in version 0.5.0.

property width#

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

New in version 0.5.0.