nmelehan
nmelehan

Reputation: 51

A paperjs-equivalent for python (specifically, Pythonista for iOS)?

I've taken to creative coding on my iPad and iPhone using Codea, Procoding, and Pythonista. I really love the paper.js Javascript library, and I'm wondering how I might have the functionality that I find in paper.js when writing in Python.

Specifically, I'd love to have the vector math and path manipulation that paper.js affords. Things like finding the intersection of two paths or binding events to paths (on click, mouse move, etc).

There's an ImagePath module provided by Pythonista that does some path stuff but it's not as robust as paper.js (it seems).

Any ideas?

Upvotes: 4

Views: 1012

Answers (1)

Luke Taylor
Luke Taylor

Reputation: 9561

The ui module actually includes a lot of vector drawing functions, inside a ui.ImageContext. ui.ImageContext is a thin wrapper around part of one of the Objective-C APIs (maybe CALayer?) The drawing methods are designed to operate inside the draw method of a custom view class, but you can present these things in other contexts using a UIImageContext, from which you can get a static image.

Upvotes: 1

Related Questions