Skip to content

How to copy a Py5Graphics object? #347

Answered by hx2A
villares asked this question in Q&A
Discussion options

You must be logged in to vote

Python's copy library isn't going to be able to copy py5 objects because it isn't able to copy the Java objects. And it seems Processing doesn't do that either, because that's not how the copy() method works.

However, it should be possible to simulate a copy to a new Py5Graphics object by using copy() and then drawing the Py5Image object to a properly sized Py5Graphics object with the background() method. But wait: what about the fill, stroke, stroke weight settings, etc? Getting all of that duplicated would be a lot of work.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by villares
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants