我需要向供应商电子邮件列表发送两个附件和一个分数,我目前正在使用此代码。如您所见,我使用邮件正文中列A上的信息。 cell.Offset(0,-1).Value 我想在文本正文中包含10列带有文本数据的列。有人可以帮我吗?
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
import numpy as np
class DraggableScatter():
epsilon = 5
def __init__(self, scatter):
self.scatter = scatter
self._ind = None
self.ax = scatter.axes
self.canvas = self.ax.figure.canvas
self.canvas.mpl_connect('button_press_event', self.button_press_callback)
self.canvas.mpl_connect('button_release_event', self.button_release_callback)
self.canvas.mpl_connect('motion_notify_event', self.motion_notify_callback)
def get_ind_under_point(self, event):
xy = np.asarray(self.scatter.get_offsets())
xyt = self.ax.transData.transform(xy)
xt, yt = xyt[:, 0], xyt[:, 1]
d = np.sqrt((xt - event.x)**2 + (yt - event.y)**2)
ind = d.argmin()
if d[ind] >= self.epsilon:
ind = None
return ind
def button_press_callback(self, event):
if event.inaxes is None:
return
if event.button != 1:
return
self._ind = self.get_ind_under_point(event)
def button_release_callback(self, event):
if event.button != 1:
return
self._ind = None
def motion_notify_callback(self, event):
if self._ind is None:
return
if event.inaxes is None:
return
if event.button != 1:
return
x, y = event.xdata, event.ydata
xy = np.asarray(self.scatter.get_offsets())
xy[self._ind] = np.array([x, y])
self.scatter.set_offsets(xy)
self.canvas.draw_idle()
fig, ax = plt.subplots(1, 1)
scatter = ax.scatter(np.random.rand(10), np.random.rand(10), marker ='o')
ds = DraggableScatter(scatter)
def init():
ax.set_xlim(0, 1)
ax.set_ylim(0, 1)
return ds.scatter,
def update(frame, ds):
x, y = np.random.rand(10), np.random.rand(10)
ds.scatter.set_offsets(np.column_stack([x, y]))
return ds.scatter,
ani = FuncAnimation(fig=fig, func=update, init_func=init, fargs=[ds], blit=True,
interval=5000)
plt.show()