Open typemytype opened 2 years ago
using the default mac https://developer.apple.com/documentation/appkit/nssharingservice
import AppKit import tempfile import os root = tempfile.TemporaryDirectory() def shareImage(ext, service="airdrop", **kwargs): path = os.path.join(root.name, f"drawBotShared.{ext}") saveImage(path, **kwargs) url = AppKit.NSURL.fileURLWithPath_(path) serviceMap = dict( airdrop=AppKit.NSSharingServiceNameSendViaAirDrop, mail=AppKit.NSSharingServiceNameComposeEmail, message=AppKit.NSSharingServiceNameComposeMessage, ) sharingService = AppKit.NSSharingService.sharingServiceNamed_(serviceMap[service]) sharingService.performWithItems_([url]) rect(10, 10, 10, 500) fill(1, 0, 0) oval(100, 100, 500, 600) shareImage("pdf")
using the default mac https://developer.apple.com/documentation/appkit/nssharingservice