popsicle is JUCE Python Bindings on top of cppyy
Project description
popsicle
Popsicle is a project that aims to give JUCE (https://juce.com/) a broader audience by allowing it to be used from python. Thanks to cppyy (http://cppyy.readthedocs.io/en/latest/) it exposes the JUCE framework api in a pythonic way, and the way it enables to write apps in python is very much similar to the way of writing them in C++ but without the overweight of managing project build, configurations and IDE solutions.
Features
Easy and quick to iterate over a JUCE application, no need to setup a build environment.
The way it allows to write JUCE code is very similar to how you would write it in C++.
It allows to mix Python and C++, and even compile C++ code at runtime when needed.
It is fast, and when the speed of C++ is required, it is possible to write those parts in C++ directly.
Example usage
A single 80 lines script is better than thousand of words:
from popsicle import juce_gui_basics
from popsicle import juce, juce_multi, START_JUCE_APPLICATION
class MainContentComponent(juce_multi(juce.Component, juce.Timer)):
def __init__(self):
super().__init__((), ())
self.setSize(600, 400)
self.startTimerHz(60)
def __del__(self):
self.stopTimer()
def paint(self, g):
g.fillAll(juce.Colours.black)
random = juce.Random.getSystemRandom()
rect = juce.Rectangle[int](0, 0, 20, 20)
for _ in range(100):
g.setColour(juce.Colour(
random.nextInt(256),
random.nextInt(256),
random.nextInt(256)))
rect.setCentre(random.nextInt(self.getWidth()), random.nextInt(self.getHeight()))
g.drawRect(rect)
def timerCallback(self):
if self.isVisible():
self.repaint()
class MainWindow(juce.DocumentWindow):
component = None
def __init__(self):
super().__init__(
juce.JUCEApplication.getInstance().getApplicationName(),
juce.Desktop.getInstance().getDefaultLookAndFeel()
.findColour(juce.ResizableWindow.backgroundColourId),,
juce.DocumentWindow.allButtons,
True)
self.component = MainContentComponent()
self.setResizable(True, True)
self.setContentNonOwned(self.component, True)
self.centreWithSize(800, 600)
self.setVisible(True)
def __del__(self):
if hasattr(self, "component"):
self.component.__del__()
self.component = None
def closeButtonPressed(self):
juce.JUCEApplication.getInstance().systemRequestedQuit()
class Application(juce.JUCEApplication):
window = None
def getApplicationName(self):
return "JUCE-o-matic"
def getApplicationVersion(self):
return "1.0"
def initialise(self, commandLine):
self.window = MainWindow()
def shutdown(self):
if hasattr(self, "window"):
self.window.__del__()
self.window = None
if __name__ == "__main__":
START_JUCE_APPLICATION(Application)
As easy as that ! You will find more example on JUCE usage in the examples folder.
Example Applications
Some images of JUCE tutorials and other small apps ported to popsicle.
Animated Component (https://docs.juce.com/master/tutorial_animation.html)
Audio Player with waveforms (https://docs.juce.com/master/tutorial_audio_thumbnail.html)
Slider decibels (https://docs.juce.com/master/tutorial_synth_db_level_control.html)
Slider values example (https://docs.juce.com/master/tutorial_slider_values.html)
Wavetable oscillator (https://docs.juce.com/master/tutorial_wavetable_synth.html)
Responsive GUI layouts using FlexBox and Grid (https://docs.juce.com/master/tutorial_flex_box_grid.html)
Advanced GUI layout techniques (https://docs.juce.com/master/tutorial_rectangle_advanced.html)
Table listbox (https://docs.juce.com/master/tutorial_table_list_box.html)
Super Simple Animated Graphics
Installation
Installing popsicle is as easy as pulling from pypi (osx only for now):
pip3 install popsicle
Make sure you have a recent pip if you are on BigSur intel.
Build From Source
Clone the repository recursively as JUCE is a submodule
git clone --recursive git@github.com:kunitoki/popsicle.git
Install python dependencies.
pip3 install "cppyy>=2.3.1"
Then it’s possible to package a wheel and install it (currently this is only tested on macOS and Linux):
# Cleanup the temporary folders
python3 setup.py clean --all
# Build the binary distribution
python3 setup.py bdist_wheel
# Install the local wheel
pip3 install dist/popsicle-*.whl
Eventually uploading to PyPI:
python3 -m twine upload --repository popsicle dist/popsicle-*.whl
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for popsicle-0.0.10-pp38-pypy38_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc225225d6620f5014eca4cc0623bf2f6bd61ab3875bdbab15e4a12f414e4fa1 |
|
MD5 | 0f812370682cc295431e89a0e7eefb1c |
|
BLAKE2b-256 | d47b561c9b8caecd0ca5da3e34dbc702116d340855eb06ef58134a11bac6cd64 |
Hashes for popsicle-0.0.10-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95dbd7cd78637d5b9674e095a3d5a1b045122b20665a53135368390d0569188c |
|
MD5 | 62a0dcebafb8f53fefb8bb99569146a0 |
|
BLAKE2b-256 | 7eddc67c9074eae247662d8819cec060e09499c86885fbd4c3d3ef2d8e735334 |
Hashes for popsicle-0.0.10-pp38-pypy38_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8c1351e9aeebb0b7e6156e1b2bf0bd92c5587ec031f169cd19091377ae09615 |
|
MD5 | 074b3b02b2f7fadcff82a8e2fa793be7 |
|
BLAKE2b-256 | 0bb626a17280fe34d3055dc28639b626a942066c61c0a4f43d4a1dcaeef635af |
Hashes for popsicle-0.0.10-pp37-pypy37_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0ccab4f9dd0b2c7c5638ec26fcf15c2092fd32514aa8ef6d1df1095b0f25d2c |
|
MD5 | 39ef70d0519d66179e3c4c558dea8050 |
|
BLAKE2b-256 | 4a5e4e8fc79467604e4514a7b9f321a4703622438d2b3e53f756f1973326ea47 |
Hashes for popsicle-0.0.10-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b374d3937f327b3ea5bc3e3f052f4de0a2651bd60d7c104f9e27920bb47df57a |
|
MD5 | 14150cbfce6375141dde22eaf26e38ae |
|
BLAKE2b-256 | 1ddb98d9629125d2e61e9284fbca1ad2ea78b1140255edb4b27adb7239a60219 |
Hashes for popsicle-0.0.10-pp37-pypy37_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44e5a841482ac4865f4731858acf1cdbe240c0104f9b7a1b49572094b7b980cf |
|
MD5 | 73e4d871589cd8dc6894c8f614fcfdd9 |
|
BLAKE2b-256 | 134d3ee453b1d842c7dca18f3b01bde0f58c6bdae1a26f813208107ff1ffdb05 |
Hashes for popsicle-0.0.10-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53401ab8a9363106fa564adea9b26f0b82d42a35c6cec757ff43483479adc487 |
|
MD5 | 293ea0d785cbdaca2bb2c4a5f68856e9 |
|
BLAKE2b-256 | 833c3368ecdaa9844ebc6ebe593ee59344f3bfd26d2559303585c2141177c757 |
Hashes for popsicle-0.0.10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8662f5ecf37c32c1adaa69328d016d9940c32d7345bbc9b490ff3390805dece4 |
|
MD5 | 7cacc811baa20fb2a001080652c089f1 |
|
BLAKE2b-256 | 44abbd3c3055032f1ceb2b6f12684915f870fd873ab78e078794fdbeb9a84600 |
Hashes for popsicle-0.0.10-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be753a84f445edb2940db8a3558def5d6693d9e072ee59f6072d50eb1819a6d2 |
|
MD5 | 9dbc8b5bf62247f8a46f3a703ec0eb02 |
|
BLAKE2b-256 | 761ffaf46e9a38c446b136788641a11d5c94ee6cd759065ed680f4c453542d34 |
Hashes for popsicle-0.0.10-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc0d013d3a6b6c881f495378d19e0b7e3a8b4f9acb19343b4ed015d01b5149ac |
|
MD5 | 288840b0acc262fd767e1d57612188b3 |
|
BLAKE2b-256 | 93e4cc53e2e383dabfcc62bd8891e58216df115c53d11d69c6a259707bc483ed |
Hashes for popsicle-0.0.10-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf0238a14fc2ab8de6a0951099926206e0aa446b6da5e945f45746ee1ad99bea |
|
MD5 | 1f8657dc5d2fcb3892d1d691871b2007 |
|
BLAKE2b-256 | a24d573b7210e3eed9a06a92bcb4d985585e799cb34b9c6d4aff6445c08b9f6c |
Hashes for popsicle-0.0.10-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a380177ea5ebd899897bac2568718e353f3f6e38ec3ba21298ba9b3668c0e4f |
|
MD5 | 2262ce609be4d498c7f4c1b9d9f9a848 |
|
BLAKE2b-256 | 067531a298f555f1c15e08e2d57af23fcfe7a71a39e5292b60c48b6d3825f6bb |
Hashes for popsicle-0.0.10-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7af019999dc32e1d1eb96e083ab0d8adffa69226df72c0f8bcd898ec028f9bd7 |
|
MD5 | 5417ee62d5f0fe1bc23765e8db135135 |
|
BLAKE2b-256 | 903c4e9a05760a1511e45b6bcb9e60c530a237e9852a4de107ff50d9211fb586 |
Hashes for popsicle-0.0.10-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6794744b9a7c5c0c66b14f9f83ba6647a021b12fd9c2e23ed370169bbfe05fc |
|
MD5 | 9ca70d70f8aaac86e71ce57442ca037c |
|
BLAKE2b-256 | 5aef72beddcc69acd103c1047af7b023397f32e2240b3080139e1ebb853b97b4 |
Hashes for popsicle-0.0.10-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a306d907de7687400b542f41882a55f941a379f75cffb197ecac453fba200098 |
|
MD5 | e6e97018bc62a3f09837dda8adce3ab2 |
|
BLAKE2b-256 | 3c6eb2566c09a1bfc4ae7b782a809a85dcb391d43bd62e17bd996b510598fcc8 |
Hashes for popsicle-0.0.10-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e999349a45fbcfb92ad28744d8b9c3fbeef22a025f0ae6c86f492200d79302e |
|
MD5 | 8bf673fbd0d359b4eab6fd66e2479de6 |
|
BLAKE2b-256 | 016ebfde1f8b7fab7c1dac303ab9993e7caa78f99cdd9632d916a1ff5b48e291 |
Hashes for popsicle-0.0.10-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4aa6bf098b9a02f4cd853f8ffdc0be56c2f29c96a77a909f8046b1cd10717750 |
|
MD5 | 08d5fb7d734e516677ee0d7233e9c160 |
|
BLAKE2b-256 | 1729047afba5735bdf8e6ac433cba80eced6752d22519e24f76da95c3abca6a4 |
Hashes for popsicle-0.0.10-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a316345b7b68436cecf0c7b7a386debab3e3bf8221a135e15ce12889d5f72e2 |
|
MD5 | 85b5828619803a7ecea41f638f40a9f2 |
|
BLAKE2b-256 | 0f93a025ef868f75b1dae57eb975342c0ac93ec214e30eed57b2603a9c8cbecb |
Hashes for popsicle-0.0.10-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b4d81b42491edf44ba9c827047f69abd0f2a0a076cbe361d8df127bb317502e |
|
MD5 | 531b674eff1b6f5fd8de3eb101514e8b |
|
BLAKE2b-256 | 9b1d670f7894319d834dab20154524c8c9a518a7644bd658a63a97f0be098127 |
Hashes for popsicle-0.0.10-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5abbd417de96552a50dabfe608e42e21b5d1d0119154ea984d6b216e6329ae8e |
|
MD5 | beb224ade1f8a39f03769795c3e7709f |
|
BLAKE2b-256 | dc9892c7dda3a2ad84b3e2ff00243dce1ca65431e752cf0c5ddd3445cbf244b0 |
Hashes for popsicle-0.0.10-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e3f16d53537d1b988152bbe840d18cf02a9cdf9ff9d297493c8816a68bf218b |
|
MD5 | 8b961f3f76cd874da298e74613d5a182 |
|
BLAKE2b-256 | 6d14f1bd99eb373cb3594f1ead31f8037dd07969bf09dfce80c30afe5454fc4c |