I made a little hourglass demo using #Pymunk (2D physics) and #Tkinter ( #TCL / #Tk Gui via #Python). It's nothing special, but fun to watch.

https://codeberg.org/sforman/OddsAndEnds/src/branch/main/Physical

sketch-a-day/2025/sketch_2025_05_02 at main · villares/sketch-a-day

One visual idea a day. Contribute to villares/sketch-a-day development by creating an account on GitHub.

GitHub
sketch-a-day/2025/sketch_2025_04_29 at main · villares/sketch-a-day

One visual idea a day. Contribute to villares/sketch-a-day development by creating an account on GitHub.

GitHub
A small Pymunk example for class.
No interactive segment-wall drawing for this one. And I can't use pickle for this sketch in imported mode :(
(see previous day for both features and the triangulated polys!) Code at: https://github.com/villares/sketch-a-day/tree/main/2025/sketch_2025_04_28
More sketch-a-day: https://abav.lugaralgum.com/sketch-a-day
If you like this, support my work:
https://www.paypal.com/donate/?hosted_button_id=5B4MZ78C9J724
https://liberapay.com/Villares
https://wise.com/pay/me/alexandrev562
#pymunk #Processing #Python #py5 #CreativeCoding
sketch-a-day/2025/sketch_2025_04_28 at main · villares/sketch-a-day

One visual idea a day. Contribute to villares/sketch-a-day development by creating an account on GitHub.

GitHub
I want to simplify #pymunk + #py5 use for my students but I struggle with finding good strategies… Pymunk has two types of (linked) objects for each simulated object: body and shape. For complex objects (like concave shapes) you can use more than one convex shape linked to the same body. In these cases I usually want to have an extra shape to draw and hide the triangulation.
I don't want to keep extra data structures to track the simulation objects to draw. I tried both extending and monkey patching either body or shape objects to be "drawable" so I can just iterate the native pymunk structures and ask stuff to draw themselves (would be nice, huh?), but there is always some snag. If I extend shape classes, I stumble on the complex objects with many shapes drawn with divisions. If I extend the Body class, the problem is static objects have shapes but share a virtual constant body, more of a flag, so I can't add anything to it, so back to keeping track of a separate list of static shapes… Then performance & serialization issues, I want to be able to easily pickle simulations, but if I add Py5Shape objects to the extended/modified classes they become unpickable...
I have bigger fishes to fry right now (the paralyzing PhD) but this is something I would like to pair with someone more experienced to work on.
sketch-a-day/2025/sketch_2025_04_24 at main · villares/sketch-a-day

One visual idea a day. Contribute to villares/sketch-a-day development by creating an account on GitHub.

GitHub
sketch-a-day/2025/sketch_2025_04_23 at main · villares/sketch-a-day

One visual idea a day. Contribute to villares/sketch-a-day development by creating an account on GitHub.

GitHub
sketch-a-day/2025/sketch_2025_04_23 at main · villares/sketch-a-day

One visual idea a day. Contribute to villares/sketch-a-day development by creating an account on GitHub.

GitHub