Код: Выделить всё
def copy_image_to_memory(image: plt.figure, close: bool = False) -> None:
from io import BytesIO
from subprocess import run
plt.savefig(buffer := BytesIO(), format='png', facecolor='white')
buffer.seek(0)
run('pbcopy', input=buffer.read(), check=True, shell=True)
print("Image copied to memory")
if close:
print("Closing image")
plt.close()
else:
print("Image not closed")
Любая помощь приветствуется.
Подробнее здесь: https://stackoverflow.com/questions/791 ... screenshot
Мобильная версия