Skip to content

Salable/streamlit-p5

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

streamlit_sp5

Embed your processing sketches in Streamlit!

Installation instructions

pip install streamlit streamlit_p5

Quickstart

streamlit run example.py

Usage instructions

The sketch object takes a few arguments:

  • sketch : a string representing your P5js sketch
  • width : width of the element in Streamlit
  • height : height of the element in Streamlit (make sure to match these with your sketch!)

Example:

import streamlit as st
from streamlit_p5 import sketch

p5_sketch = sketch("""
function setup() {
   createCanvas(700, 500);
}

// The background function is a statement that tells the computer
// which color (or gray value) to make the background of the display window 
function draw() {
   background(204, 153, 0);
}
""", width=700, height=500)

Wanna build this from source? just run:

python setup.py sdist bdist_wheel

Releases

No releases published

Packages

No packages published

Languages

  • Python 89.8%
  • HTML 10.2%