Picture

class Picture(impl=None)

图片对象是 pictures 集合中的一员:

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

在 0.9.0 版本发生变更.

property api

返回正在使用的引擎的原生对象( pywin32appscript 对象)。

Added in version 0.9.0.

delete()

删除图片。

Added in version 0.5.0.

property height

获得或者设置图片的高度,单位是 point

Added in version 0.5.0.

property left

获得或者设置图片的水平位置,单位是 point

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

获得或者设置图片的名字。

Added in version 0.5.0.

property parent

返回图片所属的对象。

Added in version 0.9.0.

property top

获得或者设置图片的垂直位置,单位是 point

Added in version 0.5.0.

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

用新的图片替换原有的图片,继承原来图片的属性。

Arguments

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

是文件路径名或者是Matplotlib图形对象。

formatstr, default None

See under Pictures.add()

export_optionsdict, default None

See under Pictures.add()

Added in version 0.5.0.

property width

获得或者设置图片的宽度,单位是 point

Added in version 0.5.0.